Comparing version 0.1.0 to 0.2.1
{ | ||
"name": "sift", | ||
"description": "mongodb query style array filtering", | ||
"version": "0.1.0", | ||
"version": "0.2.1", | ||
"repository": {}, | ||
@@ -6,0 +6,0 @@ "engines": {}, |
26
sift.js
@@ -455,3 +455,3 @@ /* | ||
//build the filter for the sifter | ||
var filter = _queryParser.parse( query ); | ||
var filter = _queryParser.parse(query); | ||
@@ -471,25 +471,8 @@ //the function used to sift through the given array | ||
//priority = -1? it's not something we can use. | ||
if(!~(priority = filter.priority( testValue ))) continue; | ||
if(!~(priority = filter.priority(testValue))) continue; | ||
//push all the sifted values to be sorted later. This is important particularly for statements | ||
//such as $or | ||
sifted.push({ | ||
value: value, | ||
priority: priority | ||
}); | ||
sifted.push(value); | ||
} | ||
//sort the values | ||
sifted.sort(function(a, b) { | ||
return a.priority > b.priority ? -1 : 1; | ||
}); | ||
var values = Array(sifted.length); | ||
//finally, fetch the values & return them. | ||
for(var i = sifted.length; i--;) { | ||
values[i] = sifted[i].value; | ||
} | ||
return values; | ||
return sifted; | ||
} | ||
@@ -535,2 +518,3 @@ | ||
if(options.operators) sift.useOperators(options.operators); | ||
if (typeof options === "function") options(sift); | ||
} | ||
@@ -537,0 +521,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
52189
23
1436
4