+1
-1
| { | ||
| "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": { |
+5
-1
@@ -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 @@ |
+19
-6
@@ -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], []], |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
148993
0.28%1558
0.91%