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

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 8.3.5 to 8.4.0

106

lib/index.js

@@ -7,3 +7,15 @@ "use strict";

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _typeof =
typeof Symbol === "function" && typeof Symbol.iterator === "symbol"
? function(obj) {
return typeof obj;
}
: function(obj) {
return obj &&
typeof Symbol === "function" &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? "symbol"
: typeof obj;
};

@@ -22,3 +34,3 @@ exports.default = sift;

var typeString = "[object " + type + "]";
return function (value) {
return function(value) {
return Object.prototype.toString.call(value) === typeString;

@@ -58,3 +70,3 @@ };

function or(validator) {
return function (a, b) {
return function(a, b) {
if (!isArray(b) || !b.length) {

@@ -74,3 +86,3 @@ return validator(a, b);

function and(validator) {
return function (a, b) {
return function(a, b) {
if (!isArray(b) || !b.length) {

@@ -94,3 +106,3 @@ return validator(a, b);

$eq: or(function (a, b) {
$eq: or(function(a, b) {
return a(b);

@@ -102,3 +114,3 @@ }),

$ne: and(function (a, b) {
$ne: and(function(a, b) {
return a(b);

@@ -110,3 +122,3 @@ }),

$gt: or(function (a, b) {
$gt: or(function(a, b) {
return a(b);

@@ -118,3 +130,3 @@ }),

$gte: or(function (a, b) {
$gte: or(function(a, b) {
return a(b);

@@ -126,3 +138,3 @@ }),

$lt: or(function (a, b) {
$lt: or(function(a, b) {
return a(b);

@@ -134,3 +146,3 @@ }),

$lte: or(function (a, b) {
$lte: or(function(a, b) {
return a(b);

@@ -142,3 +154,3 @@ }),

$mod: or(function (a, b) {
$mod: or(function(a, b) {
return a(b);

@@ -223,3 +235,3 @@ }),

$regex: or(function (a, b) {
$regex: or(function(a, b) {
return typeof b === "string" && a.test(b);

@@ -262,3 +274,3 @@ }),

if (a instanceof RegExp) {
return or(function (b) {
return or(function(b) {
return typeof b === "string" && a.test(b);

@@ -270,7 +282,7 @@ });

// Special case of a == []
return or(function (b) {
return or(function(b) {
return isArray(b) && !b.length;
});
} else if (a === null) {
return or(function (b) {
return or(function(b) {
//will match both null and undefined

@@ -280,3 +292,3 @@ return b == null;

}
return or(function (b) {
return or(function(b) {
return options.compare(comparable(b), comparable(a)) === 0;

@@ -287,3 +299,3 @@ });

$gt: function $gt(a, query, options) {
return function (b) {
return function(b) {
return options.compare(comparable(b), comparable(a)) > 0;

@@ -294,3 +306,3 @@ };

$gte: function $gte(a, query, options) {
return function (b) {
return function(b) {
return options.compare(comparable(b), comparable(a)) >= 0;

@@ -301,3 +313,3 @@ };

$lt: function $lt(a, query, options) {
return function (b) {
return function(b) {
return options.compare(comparable(b), comparable(a)) < 0;

@@ -307,3 +319,3 @@ };

$lte: function $lte(a, query, options) {
return function (b) {
return function(b) {
return options.compare(comparable(b), comparable(a)) <= 0;

@@ -314,5 +326,5 @@ };

$in: function $in(a, query, options) {
return function (b) {
return function(b) {
if (b instanceof Array) {
for (var i = b.length; i--;) {
for (var i = b.length; i--; ) {
if (~a.indexOf(comparable(get(b, i)))) {

@@ -324,4 +336,7 @@ return true;

var comparableB = comparable(b);
if (comparableB === b && (typeof b === "undefined" ? "undefined" : _typeof(b)) === "object") {
for (var i = a.length; i--;) {
if (
comparableB === b &&
(typeof b === "undefined" ? "undefined" : _typeof(b)) === "object"
) {
for (var i = a.length; i--; ) {
if (String(a[i]) === String(b) && String(b) !== "[object Object]") {

@@ -338,3 +353,3 @@ return true;

if (typeof comparableB == "undefined") {
for (var i = a.length; i--;) {
for (var i = a.length; i--; ) {
if (a[i] == null) {

@@ -349,6 +364,10 @@ return true;

*/
for (var i = a.length; i--;) {
for (var i = a.length; i--; ) {
var validator = createRootValidator(get(a, i), options);
var result = validate(validator, b, i, a);
if (result && String(result) !== "[object Object]" && String(b) !== "[object Object]") {
if (
result &&
String(result) !== "[object Object]" &&
String(b) !== "[object Object]"
) {
return true;

@@ -367,3 +386,3 @@ }

var eq = prepare.$in(a, query, options);
return function (a, b, k, o) {
return function(a, b, k, o) {
return !eq(a, b, k, o);

@@ -374,3 +393,3 @@ };

$mod: function $mod(a) {
return function (b) {
return function(b) {
return b % a[0] == a[1];

@@ -385,3 +404,3 @@ };

var eq = prepare.$eq(a, query, options);
return and(function (a, b, k, o) {
return and(function(a, b, k, o) {
return !eq(a, b, k, o);

@@ -424,3 +443,3 @@ });

var v = parse(options)(a);
return function (b, k, o) {
return function(b, k, o) {
return !validate(v, b, k, o);

@@ -431,3 +450,3 @@ };

$type: function $type(a) {
return function (b, k, o) {
return function(b, k, o) {
return b != void 0 ? b instanceof a || b.constructor == a : false;

@@ -549,3 +568,9 @@ };

function isVanillaObject(value) {
return value && (value.constructor === Object || value.constructor === Array || value.constructor.toString() === "function Object() { [native code] }" || value.constructor.toString() === "function Array() { [native code] }");
return (
value &&
(value.constructor === Object ||
value.constructor === Array ||
value.constructor.toString() === "function Object() { [native code] }" ||
value.constructor.toString() === "function Array() { [native code] }")
);
}

@@ -573,3 +598,5 @@

var expression = expressions[key] || options && options.expressions && options.expressions[key];
var expression =
expressions[key] ||
(options && options.expressions && options.expressions[key]);

@@ -592,3 +619,5 @@ if (expression) {

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

@@ -682,3 +711,3 @@

var validator = createRootValidator(query, options);
return function (b, k, o) {
return function(b, k, o) {
return validate(validator, b, k, o);

@@ -693,3 +722,6 @@ };

if (isEqual(a, b)) return 0;
if ((typeof a === "undefined" ? "undefined" : _typeof(a)) === (typeof b === "undefined" ? "undefined" : _typeof(b))) {
if (
(typeof a === "undefined" ? "undefined" : _typeof(a)) ===
(typeof b === "undefined" ? "undefined" : _typeof(b))
) {
if (a > b) {

@@ -696,0 +728,0 @@ return 1;

{
"name": "sift",
"description": "mongodb query style array filtering",
"version": "8.3.5",
"version": "8.4.0",
"repository": "crcn/sift.js",

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

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