   @matchBySku: (products) ->
     skus = _.flatten(products.map((p) ->
       [p.product.masterVariant.sku].concat(p.product.variants.map((v) ->
-        v.sku)))).filter(x ->
-          !!x)
+        v.sku))))
+        .filter(Helpers.exists)
     predicate = QueryUtils.formatAttributePredicate("sku", skus)
     QueryUtils.applyPredicateToVariants(predicate)
 

        [
          QueryUtils.valueOf(p.product.masterVariant.attributes, attribute)
        ].concat(p.product.variants.map((v) ->
          QueryUtils.valueOf(v.attributes, attribute))))).filter(x ->
            !!x)
      predicate = QueryUtils.formatAttributePredicate(attribute, values)
      QueryUtils.applyPredicateToVariants(predicate)


  # @param {String} name - name of the attribute
  # @return {Any} attribute value if found
  @valueOf: (attributes, name) ->
    attrib = _.find(attributes, (attribute) ->
      attribute.name is name)
    attrib?.value

  @formatAttributePredicate: (name, items) ->
    "#{name} in (\"#{items.join('", "')}\")"

  @applyPredicateToVariants: (predicate) ->
    "masterVariant(#{predicate}) or variants(#{predicate})"
