Comparing version 3.2.6 to 3.2.7
{ | ||
"name": "sift", | ||
"description": "mongodb query style array filtering", | ||
"version": "3.2.6", | ||
"version": "3.2.7", | ||
"repository": "crcn/sift.js", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -142,3 +142,3 @@ ## validate objects & filter arrays with mongodb queries | ||
```javascript | ||
sift({ location: { $in: ['Costa Rica','Brazil'] } }, { name: 'Craig', location: 'Brazil' }); | ||
sift({ location: { $in: ['Costa Rica','Brazil'] } }, [ { name: 'Craig', location: 'Brazil' } ]); | ||
``` | ||
@@ -145,0 +145,0 @@ |
15
sift.js
@@ -72,3 +72,2 @@ /* | ||
var operator = { | ||
@@ -174,7 +173,3 @@ | ||
$all: function(a, b) { | ||
if (!b) b = []; | ||
for (var i = a.length; i--;) { | ||
if (!~comparable(b).indexOf(get(a, i))) return false; | ||
} | ||
return true; | ||
return operator.$and(a, b); | ||
}, | ||
@@ -202,2 +197,3 @@ | ||
$and: function(a, b) { | ||
if (!b) b = []; | ||
for (var i = 0, n = a.length; i < n; i++) if (!validate(get(a, i), b)) return false; | ||
@@ -287,2 +283,9 @@ return true; | ||
$all: function(a) { | ||
return prepare.$and(a); | ||
}, | ||
/** | ||
*/ | ||
$or: function(a) { | ||
@@ -289,0 +292,0 @@ return a.map(parse); |
@@ -136,2 +136,6 @@ var assert = require('assert'); | ||
[{a:{$elemMatch:{b:2,c:{$gt:2}}}}, [{a:{b:1,c:2}},{a:{b:1,c:2,d:3}},[{a:{b:2,c:3}}]], [[{a:{b:2,c:3}}]]], | ||
[ | ||
{tags: {$all: [{$elemMatch: {a: 1}}]}}, | ||
[{tags: [{a: 1}]}, {tags: [{a: 1}, {b: 1}]}], [{tags: [{a: 1}]}, {tags: [{a: 1}, {b: 1}]}] | ||
], | ||
@@ -138,0 +142,0 @@ // dot-notation |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50954
1327