Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sift

Package Overview
Dependencies
Maintainers
1
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sift - npm Package Compare versions

Comparing version 2.0.6 to 2.0.7

6

package.json
{
"name": "sift",
"description": "mongodb query style array filtering",
"version": "2.0.6",
"version": "2.0.7",
"repository": "crcn/sift.js",

@@ -26,2 +26,3 @@ "author": {

"gulp-uglify": "^1.2.0",
"nodangel": "^1.3.8",
"yargs": "^3.15.0"

@@ -31,4 +32,5 @@ },

"scripts": {
"test": "gulp test-coveralls"
"test": "gulp test-coveralls",
"tdd": "nodangel --ignore node_modules --watch test --watch sift.js --exec 'npm run test'"
}
}

@@ -46,3 +46,3 @@ /*

return function(a, b) {
if (!isArray(b)) return validator(a, b);
if (!isArray(b) || !b.length) return validator(a, b);
for (var i = 0, n = b.length; i < n; i++) if (validator(a, b[i])) return true;

@@ -246,2 +246,7 @@ return false;

return a;
} else if (isArray(a) && !a.length) {
// Special case of a == []
return function(b) {
return (isArray(b) && !b.length);
};
}

@@ -248,0 +253,0 @@

@@ -67,2 +67,16 @@ var assert = require("assert"),

});
it("can match empty arrays", function () {
var statusQuery = {$or: [{status: {$exists: false}},
{status: []},
{status: {$in: ["urgent", "completed", "today"]}}
]};
var filtered = sift(statusQuery, [{ status: [] },
{ status: ["urgent"] },
{ status: ["nope"] }
]);
assert.equal(filtered.length, 2);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc