Comparing version 2.0.10 to 3.0.0
{ | ||
"name": "sift", | ||
"description": "mongodb query style array filtering", | ||
"version": "2.0.10", | ||
"version": "3.0.0", | ||
"repository": "crcn/sift.js", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -81,3 +81,2 @@ /* | ||
$ne: and(function(a, b) { | ||
if(typeof b == 'undefined') return false; | ||
return !a(b); | ||
@@ -252,2 +251,7 @@ }), | ||
}; | ||
} else if (a === null){ | ||
return function(b){ | ||
//will match both null and undefined | ||
return b == null; | ||
} | ||
} | ||
@@ -254,0 +258,0 @@ |
@@ -82,9 +82,13 @@ var assert = require("assert"), | ||
it("$ne does not hit when field does not exist", function () { | ||
var sifter = sift({ age: { $ne: 5 }}); | ||
it("$ne: null does not hit when field is present", function(){ | ||
var sifter = sift({age: {$ne: null}}); | ||
var people = [{}], | ||
filtered = people.filter(sifter); | ||
var people = [ | ||
{age: "matched"}, | ||
{missed: 1} | ||
]; | ||
var filtered = people.filter(sifter); | ||
assert.equal(filtered.length, 0); | ||
assert.equal(filtered.length, 1); | ||
assert.equal(filtered[0].age, "matched"); | ||
}); | ||
@@ -101,3 +105,3 @@ | ||
it("$ne does hit when field exists", function () { | ||
it("$ne does hit when field exists with different value", function () { | ||
var sifter = sift({ age: { $ne: 4 }}); | ||
@@ -110,2 +114,11 @@ | ||
}); | ||
it("$ne does hit when field does not exist", function(){ | ||
var sifter = sift({ age: { $ne: 5 }}); | ||
var people = [{}], | ||
filtered = people.filter(sifter); | ||
assert.equal(filtered.length, 1); | ||
}); | ||
}); |
@@ -17,3 +17,3 @@ var assert = require('assert'); | ||
[0, [0,'0'], [0]], | ||
[null, [void 0, null], [null]], | ||
[null, [null], [null]], | ||
[void 0, [void 0, null], [void 0]], | ||
@@ -20,0 +20,0 @@ [1, [2,3,4,5], []], |
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
148993
1558