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

_ = require 'underscore'

class QueryUtils


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

