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

sift

Package Overview
Dependencies
Maintainers
2
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 3.3.12 to 4.0.0

2

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

@@ -6,0 +6,0 @@ "author": {

@@ -34,4 +34,6 @@ /*

return value.getTime();
} else if (value instanceof Array) {
} else if (isArray(value)) {
return value.map(comparable);
} else if (value && typeof value.toJSON === 'function') {
return value.toJSON();
} else {

@@ -43,6 +45,3 @@ return value;

function get(obj, key) {
if (obj.get) {
return obj.get(key);
}
return obj[key];
return isFunction(obj.get) ? obj.get(key) : obj[key];
}

@@ -84,3 +83,3 @@

var operator = {
var OPERATORS = {

@@ -104,10 +103,2 @@ /**

$or: function(a, b) {
for (var i = 0, n = a.length; i < n; i++) if (validate(get(a, i), b)) return true;
return false;
},
/**
*/
$gt: or(function(a, b) {

@@ -189,3 +180,3 @@ return sift.compare(comparable(b), a) > 0;

return Boolean(!!~a.indexOf(comparable(b)));
return !!~a.indexOf(comparableB);
}

@@ -200,3 +191,3 @@

$nin: function(a, b) {
return !operator.$in(a, b);
return !OPERATORS.$in(a, b);
},

@@ -222,3 +213,3 @@

$all: function(a, b) {
return operator.$and(a, b);
return OPERATORS.$and(a, b);
},

@@ -236,10 +227,12 @@

$or: function(a, b) {
for (var i = 0, n = a.length; i < n; i++) if (validate(get(a, i), b)) return true;
return false;
},
/**
*/
$nor: function(a, b) {
// todo - this suffice? return !operator.$in(a)
for (var i = 0, n = a.length; i < n; i++) {
if (validate(get(a, i), b)) {
return false;
}
}
return true;
return !OPERATORS.$or(a, b);
},

@@ -466,3 +459,3 @@

function isVanillaObject(value) {
return String(value.constructor) === 'Object' || String(value.constructor).replace(/[\r\n\s\t]/g, '') === 'functionObject(){[nativecode]}';
return value && value.constructor === Object;
}

@@ -486,5 +479,5 @@

if (operator[key]) {
if (OPERATORS[key]) {
if (prepare[key]) a = prepare[key](a, query);
validators.push(createValidator(comparable(a), operator[key]));
validators.push(createValidator(comparable(a), OPERATORS[key]));
} else {

@@ -500,3 +493,3 @@

return validators.length === 1 ? validators[0] : createValidator(validators, operator.$and);
return validators.length === 1 ? validators[0] : createValidator(validators, OPERATORS.$and);
}

@@ -551,3 +544,3 @@

if (key.charCodeAt(0) === 36) {
operator[key] = plugin[key];
OPERATORS[key] = plugin[key];
}

@@ -554,0 +547,0 @@ }

@@ -26,4 +26,3 @@ var assert = require('assert');

// object is not exact - there is no match here unless ObjectID is a comparable.
[ObjectID('54dd5546b1d296a54d152e84'),[ObjectID(),ObjectID('54dd5546b1d296a54d152e84')],[]],
[ObjectID('54dd5546b1d296a54d152e84'),[ObjectID(),ObjectID('54dd5546b1d296a54d152e84')],[ObjectID('54dd5546b1d296a54d152e84')]],

@@ -30,0 +29,0 @@ // $ne

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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