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.10 to 3.0.0

2

package.json
{
"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], []],

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