Comparing version 11.0.1 to 11.0.2
@@ -10,2 +10,3 @@ ## 11.0.0 | ||
- `operations` parameter now expects new operations API | ||
- ImmutableJS support removed for now | ||
@@ -12,0 +13,0 @@ ## 9.0.0 |
@@ -6,10 +6,12 @@ "use strict"; | ||
exports.EqualsOperation = core_1.EqualsOperation; | ||
var createDefaultQueryTester = function (query, _a) { | ||
var _b = _a === void 0 ? {} : _a, compare = _b.compare, operations = _b.operations; | ||
return core_1.createQueryTester(query, { | ||
compare: compare, | ||
operations: Object.assign({}, defaultOperations, operations || {}) | ||
}); | ||
var createDefaultQueryTester = function(query, _a) { | ||
var _b = _a === void 0 ? {} : _a, | ||
compare = _b.compare, | ||
operations = _b.operations; | ||
return core_1.createQueryTester(query, { | ||
compare: compare, | ||
operations: Object.assign({}, defaultOperations, operations || {}) | ||
}); | ||
}; | ||
module.exports = createDefaultQueryTester; | ||
exports.default = createDefaultQueryTester; |
{ | ||
"name": "sift", | ||
"description": "mongodb query style array filtering", | ||
"version": "11.0.1", | ||
"version": "11.0.2", | ||
"repository": "crcn/sift.js", | ||
"sideEffects": false, | ||
"author": { | ||
@@ -7,0 +8,0 @@ "name": "Craig Condon", |
@@ -17,8 +17,5 @@ **Installation**: `npm install sift`, or `yarn add sift` | ||
- Function filtering | ||
- sub object searching | ||
- dot notation searching | ||
- Supports node.js, and web | ||
- Small (2 kb minified) library | ||
- Custom Expressions | ||
- filtering of immutable datastructures | ||
- Custom Operations | ||
@@ -25,0 +22,0 @@ ## Node.js Examples |
@@ -1,656 +0,2 @@ | ||
!(function(t, n) { | ||
"object" == typeof exports && "object" == typeof module | ||
? (module.exports = n()) | ||
: "function" == typeof define && define.amd | ||
? define([], n) | ||
: "object" == typeof exports | ||
? (exports.sift = n()) | ||
: (t.sift = n()); | ||
})(this, function() { | ||
return (function(t) { | ||
var n = {}; | ||
function e(r) { | ||
if (n[r]) return n[r].exports; | ||
var o = (n[r] = { i: r, l: !1, exports: {} }); | ||
return t[r].call(o.exports, o, o.exports, e), (o.l = !0), o.exports; | ||
} | ||
return ( | ||
(e.m = t), | ||
(e.c = n), | ||
(e.d = function(t, n, r) { | ||
e.o(t, n) || Object.defineProperty(t, n, { enumerable: !0, get: r }); | ||
}), | ||
(e.r = function(t) { | ||
"undefined" != typeof Symbol && | ||
Symbol.toStringTag && | ||
Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), | ||
Object.defineProperty(t, "__esModule", { value: !0 }); | ||
}), | ||
(e.t = function(t, n) { | ||
if ((1 & n && (t = e(t)), 8 & n)) return t; | ||
if (4 & n && "object" == typeof t && t && t.__esModule) return t; | ||
var r = Object.create(null); | ||
if ( | ||
(e.r(r), | ||
Object.defineProperty(r, "default", { enumerable: !0, value: t }), | ||
2 & n && "string" != typeof t) | ||
) | ||
for (var o in t) | ||
e.d( | ||
r, | ||
o, | ||
function(n) { | ||
return t[n]; | ||
}.bind(null, o) | ||
); | ||
return r; | ||
}), | ||
(e.n = function(t) { | ||
var n = | ||
t && t.__esModule | ||
? function() { | ||
return t.default; | ||
} | ||
: function() { | ||
return t; | ||
}; | ||
return e.d(n, "a", n), n; | ||
}), | ||
(e.o = function(t, n) { | ||
return Object.prototype.hasOwnProperty.call(t, n); | ||
}), | ||
(e.p = ""), | ||
e((e.s = 2)) | ||
); | ||
})([ | ||
function(t, n, e) { | ||
"use strict"; | ||
var r, | ||
o = | ||
(this && this.__extends) || | ||
((r = function(t, n) { | ||
return (r = | ||
Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && | ||
function(t, n) { | ||
t.__proto__ = n; | ||
}) || | ||
function(t, n) { | ||
for (var e in n) n.hasOwnProperty(e) && (t[e] = n[e]); | ||
})(t, n); | ||
}), | ||
function(t, n) { | ||
function e() { | ||
this.constructor = t; | ||
} | ||
r(t, n), | ||
(t.prototype = | ||
null === n | ||
? Object.create(n) | ||
: ((e.prototype = n.prototype), new e())); | ||
}), | ||
i = | ||
(this && this.__spreadArrays) || | ||
function() { | ||
for (var t = 0, n = 0, e = arguments.length; n < e; n++) | ||
t += arguments[n].length; | ||
var r = Array(t), | ||
o = 0; | ||
for (n = 0; n < e; n++) | ||
for (var i = arguments[n], u = 0, s = i.length; u < s; u++, o++) | ||
r[o] = i[u]; | ||
return r; | ||
}; | ||
Object.defineProperty(n, "__esModule", { value: !0 }); | ||
var u = e(1), | ||
s = function(t, n, e, r, o, i) { | ||
var c = n[r]; | ||
if (u.isArray(t) && isNaN(Number(c))) | ||
for (var a = 0, p = t.length; a < p; a++) | ||
if (!s(t[a], n, e, r, a, t)) return !1; | ||
return r === n.length || null == t | ||
? e(t, o, i) | ||
: s(t[c], n, e, r + 1, c, t); | ||
}, | ||
c = (function() { | ||
function t(t, n, e) { | ||
(this.params = t), | ||
(this.owneryQuery = n), | ||
(this.options = e), | ||
this.init(); | ||
} | ||
return ( | ||
(t.prototype.init = function() {}), | ||
(t.prototype.reset = function() { | ||
(this.done = !1), (this.success = !1); | ||
}), | ||
t | ||
); | ||
})(); | ||
n.BaseOperation = c; | ||
var a = (function(t) { | ||
function n(n, e, r, o) { | ||
var i = t.call(this, n, e, r) || this; | ||
return (i._children = o), i; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.reset = function() { | ||
(this.success = !1), (this.done = !1); | ||
for (var t = 0, n = this._children.length; t < n; t++) | ||
this._children[t].reset(); | ||
}), | ||
(n.prototype.childrenNext = function(t, n, e) { | ||
for ( | ||
var r = !0, o = !0, i = 0, u = this._children.length; | ||
i < u; | ||
i++ | ||
) { | ||
var s = this._children[i]; | ||
if ((s.next(t, n, e), s.success || (o = !1), s.done)) { | ||
if (!s.success) break; | ||
} else r = !1; | ||
} | ||
(this.done = r), (this.success = o); | ||
}), | ||
n | ||
); | ||
})(c); | ||
n.GroupOperation = a; | ||
var p = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function(t, n, e) { | ||
this.childrenNext(t, n, e); | ||
}), | ||
n | ||
); | ||
})(a); | ||
n.QueryOperation = p; | ||
var f = (function(t) { | ||
function n(n, e, r, o, i) { | ||
var u = t.call(this, e, r, o, i) || this; | ||
return ( | ||
(u.keyPath = n), | ||
(u._nextNestedValue = function(t, n, e) { | ||
return u.childrenNext(t, n, e), !u.done; | ||
}), | ||
u | ||
); | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function(t, n, e) { | ||
s(t, this.keyPath, this._nextNestedValue, 0, n, e); | ||
}), | ||
n | ||
); | ||
})(a); | ||
(n.NestedOperation = f), | ||
(n.createTester = function(t, n) { | ||
if (t instanceof Function) return t; | ||
if (t instanceof RegExp) | ||
return function(n) { | ||
return "string" == typeof n && t.test(n); | ||
}; | ||
var e = u.comparable(t); | ||
return function(t) { | ||
return n(e, u.comparable(t)); | ||
}; | ||
}); | ||
var l = (function(t) { | ||
function e() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(e, t), | ||
(e.prototype.init = function() { | ||
this._test = n.createTester(this.params, this.options.compare); | ||
}), | ||
(e.prototype.next = function(t, n, e) { | ||
this._test(t, n, e) && ((this.done = !0), (this.success = !0)); | ||
}), | ||
e | ||
); | ||
})(c); | ||
n.EqualsOperation = l; | ||
var h = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function() { | ||
(this.done = !0), (this.success = !1); | ||
}), | ||
n | ||
); | ||
})(c); | ||
(n.NopeOperation = h), | ||
(n.numericalOperationCreator = function(t) { | ||
return function(n, e, r) { | ||
return null == n ? new h(n, e, r) : t(n, e, r); | ||
}; | ||
}); | ||
var y = function(t, n, e, r) { | ||
var o = r.operations[t]; | ||
if (!o) throw new Error("Unsupported operation: " + t); | ||
return o(n, e, r); | ||
}, | ||
O = function(t, n, e, r) { | ||
if ( | ||
(function(t) { | ||
for (var n in t) if ("$" === n.charAt(0)) return !0; | ||
return !1; | ||
})(n) | ||
) { | ||
var o = d(n, r), | ||
i = o[0]; | ||
if (o[1].length) | ||
throw new Error( | ||
"Property queries must contain only operations, or exact objects." | ||
); | ||
return new f(t, n, e, r, i); | ||
} | ||
return new f(t, n, e, r, [new l(n, e, r)]); | ||
}; | ||
n.createQueryOperation = function(t, n, e) { | ||
var r = d(t, e), | ||
o = r[0], | ||
u = r[1], | ||
s = i([new f([], t, n, e, o)], u); | ||
return 1 === s.length ? s[0] : new p(t, n, e, s); | ||
}; | ||
var d = function(t, n) { | ||
var e = [], | ||
r = []; | ||
for (var o in (u.isVanillaObject(t) || (t = { $eq: t }), t)) | ||
if ("$" === o.charAt(0)) { | ||
var i = y(o, t[o], t, n); | ||
null != i && e.push(i); | ||
} else r.push(O(o.split("."), t[o], t, n)); | ||
return [e, r]; | ||
}; | ||
n.createQueryTester = function(t, e) { | ||
var r = void 0 === e ? {} : e, | ||
o = r.compare, | ||
i = r.operations, | ||
s = n.createQueryOperation(t, null, { | ||
compare: o || u.equals, | ||
operations: Object.assign({}, i || {}) | ||
}); | ||
return function(t, n, e) { | ||
return s.reset(), s.next(t, n, e), s.success; | ||
}; | ||
}; | ||
}, | ||
function(t, n, e) { | ||
"use strict"; | ||
Object.defineProperty(n, "__esModule", { value: !0 }), | ||
(n.typeChecker = function(t) { | ||
var n = "[object " + t + "]"; | ||
return function(t) { | ||
return r(t) === n; | ||
}; | ||
}); | ||
var r = function(t) { | ||
return Object.prototype.toString.call(t); | ||
}; | ||
(n.comparable = function(t) { | ||
return t instanceof Date | ||
? t.getTime() | ||
: n.isArray(t) | ||
? t.map(n.comparable) | ||
: t && "function" == typeof t.toJSON | ||
? t.toJSON() | ||
: t; | ||
}), | ||
(n.isArray = n.typeChecker("Array")), | ||
(n.isObject = n.typeChecker("Object")), | ||
(n.isFunction = n.typeChecker("Function")), | ||
(n.isVanillaObject = function(t) { | ||
return ( | ||
t && | ||
(t.constructor === Object || | ||
t.constructor === Array || | ||
"function Object() { [native code] }" === | ||
t.constructor.toString() || | ||
"function Array() { [native code] }" === | ||
t.constructor.toString()) && | ||
!t.toJSON | ||
); | ||
}), | ||
(n.equals = function(t, e) { | ||
if (null == t && t == e) return !0; | ||
if (t === e) return !0; | ||
if ( | ||
Object.prototype.toString.call(t) !== | ||
Object.prototype.toString.call(e) | ||
) | ||
return !1; | ||
if (n.isArray(t)) { | ||
if (t.length !== e.length) return !1; | ||
for (var r = 0, o = t.length; r < o; r++) | ||
if (!n.equals(t[r], e[r])) return !1; | ||
return !0; | ||
} | ||
if (n.isObject(t)) { | ||
if (Object.keys(t).length !== Object.keys(e).length) return !1; | ||
for (var i in t) if (!n.equals(t[i], e[i])) return !1; | ||
return !0; | ||
} | ||
return !1; | ||
}); | ||
}, | ||
function(t, n, e) { | ||
t.exports = e(3); | ||
}, | ||
function(t, n, e) { | ||
"use strict"; | ||
Object.defineProperty(n, "__esModule", { value: !0 }); | ||
var r = e(4), | ||
o = e(0); | ||
n.EqualsOperation = o.EqualsOperation; | ||
var i = function(t, n) { | ||
var e = void 0 === n ? {} : n, | ||
i = e.compare, | ||
u = e.operations; | ||
return o.createQueryTester(t, { | ||
compare: i, | ||
operations: Object.assign({}, { $and: r.$and }, u || {}) | ||
}); | ||
}; | ||
(t.exports = i), (n.default = i); | ||
}, | ||
function(t, n, e) { | ||
"use strict"; | ||
var r, | ||
o = | ||
(this && this.__extends) || | ||
((r = function(t, n) { | ||
return (r = | ||
Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && | ||
function(t, n) { | ||
t.__proto__ = n; | ||
}) || | ||
function(t, n) { | ||
for (var e in n) n.hasOwnProperty(e) && (t[e] = n[e]); | ||
})(t, n); | ||
}), | ||
function(t, n) { | ||
function e() { | ||
this.constructor = t; | ||
} | ||
r(t, n), | ||
(t.prototype = | ||
null === n | ||
? Object.create(n) | ||
: ((e.prototype = n.prototype), new e())); | ||
}); | ||
Object.defineProperty(n, "__esModule", { value: !0 }); | ||
var i = e(0), | ||
u = e(1), | ||
s = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.init = function() { | ||
this._test = i.createTester(this.params, this.options.compare); | ||
}), | ||
(n.prototype.reset = function() { | ||
t.prototype.reset.call(this), (this.success = !0); | ||
}), | ||
(n.prototype.next = function(t) { | ||
this._test(t) && ((this.done = !0), (this.success = !1)); | ||
}), | ||
n | ||
); | ||
})(i.BaseOperation), | ||
c = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.init = function() { | ||
this._queryOperation = i.createQueryOperation( | ||
this.params, | ||
this.owneryQuery, | ||
this.options | ||
); | ||
}), | ||
(n.prototype.reset = function() { | ||
this._queryOperation.reset(); | ||
}), | ||
(n.prototype.next = function(t, n, e) { | ||
this._queryOperation.next(t, n, e), | ||
(this.done = this._queryOperation.done), | ||
(this.success = this._queryOperation.success); | ||
}), | ||
n | ||
); | ||
})(i.BaseOperation), | ||
a = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function(n, e, r) { | ||
t.prototype.next.call(this, n, e, r), | ||
(this.success = !this.success); | ||
}), | ||
n | ||
); | ||
})(c), | ||
p = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.init = function() { | ||
var t = this; | ||
this._ops = this.params.map(function(n) { | ||
return i.createQueryOperation(n, null, t.options); | ||
}); | ||
}), | ||
(n.prototype.reset = function() { | ||
(this.done = !1), (this.success = !1); | ||
for (var t = 0, n = this._ops.length; t < n; t++) | ||
this._ops[t].reset(); | ||
}), | ||
(n.prototype.next = function(t, n, e) { | ||
for ( | ||
var r = !1, o = !1, i = 0, u = this._ops.length; | ||
i < u; | ||
i++ | ||
) { | ||
var s = this._ops[i]; | ||
if ((s.next(t, n, e), s.success)) { | ||
(r = !0), (o = s.success); | ||
break; | ||
} | ||
} | ||
(this.success = o), (this.done = r); | ||
}), | ||
n | ||
); | ||
})(i.BaseOperation), | ||
f = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function(n, e, r) { | ||
t.prototype.next.call(this, n, e, r), | ||
(this.success = !this.success); | ||
}), | ||
n | ||
); | ||
})(p), | ||
l = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function(t, n, e) { | ||
e.hasOwnProperty(n) === this.params && | ||
((this.done = !0), (this.success = !0)); | ||
}), | ||
n | ||
); | ||
})(i.BaseOperation), | ||
h = (function(t) { | ||
function n(n, e, r) { | ||
return ( | ||
t.call( | ||
this, | ||
n, | ||
e, | ||
r, | ||
n.map(function(t) { | ||
return i.createQueryOperation(t, e, r); | ||
}) | ||
) || this | ||
); | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function(t, n, e) { | ||
this.childrenNext(t, n, e); | ||
}), | ||
n | ||
); | ||
})(i.GroupOperation); | ||
(n.$eq = function(t, n, e) { | ||
return new i.EqualsOperation(t, n, e); | ||
}), | ||
(n.$ne = function(t, n, e) { | ||
return new s(t, n, e); | ||
}), | ||
(n.$or = function(t, n, e) { | ||
return new p(t, n, e); | ||
}), | ||
(n.$nor = function(t, n, e) { | ||
return new f(t, n, e); | ||
}), | ||
(n.$elemMatch = function(t, n, e) { | ||
return new c(t, n, e); | ||
}), | ||
(n.$nin = function(t, n, e) { | ||
return new f(t, n, e); | ||
}), | ||
(n.$in = function(t, n, e) { | ||
return new p(t, n, e); | ||
}), | ||
(n.$lt = i.numericalOperationCreator(function(t, n, e) { | ||
return new i.EqualsOperation( | ||
function(n) { | ||
return n < t; | ||
}, | ||
n, | ||
e | ||
); | ||
})), | ||
(n.$lte = i.numericalOperationCreator(function(t, n, e) { | ||
return new i.EqualsOperation( | ||
function(n) { | ||
return n <= t; | ||
}, | ||
n, | ||
e | ||
); | ||
})), | ||
(n.$gt = i.numericalOperationCreator(function(t, n, e) { | ||
return new i.EqualsOperation( | ||
function(n) { | ||
return n > t; | ||
}, | ||
n, | ||
e | ||
); | ||
})), | ||
(n.$gte = i.numericalOperationCreator(function(t, n, e) { | ||
return new i.EqualsOperation( | ||
function(n) { | ||
return n >= t; | ||
}, | ||
n, | ||
e | ||
); | ||
})), | ||
(n.$mod = function(t, n, e) { | ||
var r = t[0], | ||
o = t[1]; | ||
return new i.EqualsOperation( | ||
function(t) { | ||
return u.comparable(t) % r === o; | ||
}, | ||
n, | ||
e | ||
); | ||
}), | ||
(n.$exists = function(t, n, e) { | ||
return new l(t, n, e); | ||
}), | ||
(n.$regex = function(t, n, e) { | ||
return new i.EqualsOperation(new RegExp(t, n.$options), n, e); | ||
}), | ||
(n.$not = function(t, n, e) { | ||
return new a(t, n, e); | ||
}), | ||
(n.$type = function(t, n, e) { | ||
return new i.EqualsOperation( | ||
function(n) { | ||
return null != n && (n instanceof t || n.constructor === t); | ||
}, | ||
n, | ||
e | ||
); | ||
}), | ||
(n.$and = function(t, n, e) { | ||
return new h(t, n, e); | ||
}), | ||
(n.$all = n.$and), | ||
(n.$size = function(t, n, e) { | ||
return new i.EqualsOperation( | ||
function(n) { | ||
return n && n.length === t; | ||
}, | ||
n, | ||
e | ||
); | ||
}), | ||
(n.$options = function() { | ||
return null; | ||
}), | ||
(n.$where = function(t, n, e) { | ||
var r; | ||
if (!u.isFunction(t)) | ||
throw new Error( | ||
'In CSP mode, sift does not support strings in "$where" condition' | ||
); | ||
return ( | ||
(r = t), | ||
new i.EqualsOperation( | ||
function(t) { | ||
return r.bind(t)(t); | ||
}, | ||
n, | ||
e | ||
) | ||
); | ||
}); | ||
} | ||
]); | ||
}); | ||
//# sourceMappingURL=sift.csp.min.js.map | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.sift=n():t.sift=n()}(this,(function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=2)}([function(t,n,e){"use strict";var r,o=this&&this.__extends||(r=function(t,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)},function(t,n){function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),i=this&&this.__spreadArrays||function(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;var r=Array(t),o=0;for(n=0;n<e;n++)for(var i=arguments[n],u=0,s=i.length;u<s;u++,o++)r[o]=i[u];return r};Object.defineProperty(n,"__esModule",{value:!0});var u=e(1),s=function(t,n,e,r,o,i){var c=n[r];if(u.isArray(t)&&isNaN(Number(c)))for(var a=0,p=t.length;a<p;a++)if(!s(t[a],n,e,r,a,t))return!1;return r===n.length||null==t?e(t,o,i):s(t[c],n,e,r+1,c,t)},c=function(){function t(t,n,e){this.params=t,this.owneryQuery=n,this.options=e,this.init()}return t.prototype.init=function(){},t.prototype.reset=function(){this.done=!1,this.success=!1},t}();n.BaseOperation=c;var a=function(t){function n(n,e,r,o){var i=t.call(this,n,e,r)||this;return i._children=o,i}return o(n,t),n.prototype.reset=function(){this.success=!1,this.done=!1;for(var t=0,n=this._children.length;t<n;t++)this._children[t].reset()},n.prototype.childrenNext=function(t,n,e){for(var r=!0,o=!0,i=0,u=this._children.length;i<u;i++){var s=this._children[i];if(s.next(t,n,e),s.success||(o=!1),s.done){if(!s.success)break}else r=!1}this.done=r,this.success=o},n}(c);n.GroupOperation=a;var p=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.next=function(t,n,e){this.childrenNext(t,n,e)},n}(a);n.QueryOperation=p;var f=function(t){function n(n,e,r,o,i){var u=t.call(this,e,r,o,i)||this;return u.keyPath=n,u._nextNestedValue=function(t,n,e){return u.childrenNext(t,n,e),!u.done},u}return o(n,t),n.prototype.next=function(t,n,e){s(t,this.keyPath,this._nextNestedValue,0,n,e)},n}(a);n.NestedOperation=f,n.createTester=function(t,n){if(t instanceof Function)return t;if(t instanceof RegExp)return function(n){return"string"==typeof n&&t.test(n)};var e=u.comparable(t);return function(t){return n(e,u.comparable(t))}};var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.init=function(){this._test=n.createTester(this.params,this.options.compare)},e.prototype.next=function(t,n,e){this._test(t,n,e)&&(this.done=!0,this.success=!0)},e}(c);n.EqualsOperation=l;var h=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.next=function(){this.done=!0,this.success=!1},n}(c);n.NopeOperation=h,n.numericalOperationCreator=function(t){return function(n,e,r){return null==n?new h(n,e,r):t(n,e,r)}};var y=function(t,n,e,r){var o=r.operations[t];if(!o)throw new Error("Unsupported operation: "+t);return o(n,e,r)},O=function(t,n,e,r){if(function(t){for(var n in t)if("$"===n.charAt(0))return!0;return!1}(n)){var o=d(n,r),i=o[0];if(o[1].length)throw new Error("Property queries must contain only operations, or exact objects.");return new f(t,n,e,r,i)}return new f(t,n,e,r,[new l(n,e,r)])};n.createQueryOperation=function(t,n,e){var r=d(t,e),o=r[0],u=r[1],s=i([new f([],t,n,e,o)],u);return 1===s.length?s[0]:new p(t,n,e,s)};var d=function(t,n){var e=[],r=[];for(var o in u.isVanillaObject(t)||(t={$eq:t}),t)if("$"===o.charAt(0)){var i=y(o,t[o],t,n);null!=i&&e.push(i)}else r.push(O(o.split("."),t[o],t,n));return[e,r]};n.createQueryTester=function(t,e){var r=void 0===e?{}:e,o=r.compare,i=r.operations,s=n.createQueryOperation(t,null,{compare:o||u.equals,operations:Object.assign({},i||{})});return function(t,n,e){return s.reset(),s.next(t,n,e),s.success}}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.typeChecker=function(t){var n="[object "+t+"]";return function(t){return r(t)===n}};var r=function(t){return Object.prototype.toString.call(t)};n.comparable=function(t){return t instanceof Date?t.getTime():n.isArray(t)?t.map(n.comparable):t&&"function"==typeof t.toJSON?t.toJSON():t},n.isArray=n.typeChecker("Array"),n.isObject=n.typeChecker("Object"),n.isFunction=n.typeChecker("Function"),n.isVanillaObject=function(t){return t&&(t.constructor===Object||t.constructor===Array||"function Object() { [native code] }"===t.constructor.toString()||"function Array() { [native code] }"===t.constructor.toString())&&!t.toJSON},n.equals=function(t,e){if(null==t&&t==e)return!0;if(t===e)return!0;if(Object.prototype.toString.call(t)!==Object.prototype.toString.call(e))return!1;if(n.isArray(t)){if(t.length!==e.length)return!1;for(var r=0,o=t.length;r<o;r++)if(!n.equals(t[r],e[r]))return!1;return!0}if(n.isObject(t)){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var i in t)if(!n.equals(t[i],e[i]))return!1;return!0}return!1}},function(t,n,e){t.exports=e(3)},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e(4),o=e(0);n.EqualsOperation=o.EqualsOperation;var i=function(t,n){var e=void 0===n?{}:n,i=e.compare,u=e.operations;return o.createQueryTester(t,{compare:i,operations:Object.assign({},r,u||{})})};t.exports=i,n.default=i},function(t,n,e){"use strict";var r,o=this&&this.__extends||(r=function(t,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)},function(t,n){function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)});Object.defineProperty(n,"__esModule",{value:!0});var i=e(0),u=e(1),s=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.init=function(){this._test=i.createTester(this.params,this.options.compare)},n.prototype.reset=function(){t.prototype.reset.call(this),this.success=!0},n.prototype.next=function(t){this._test(t)&&(this.done=!0,this.success=!1)},n}(i.BaseOperation),c=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.init=function(){this._queryOperation=i.createQueryOperation(this.params,this.owneryQuery,this.options)},n.prototype.reset=function(){this._queryOperation.reset()},n.prototype.next=function(t,n,e){this._queryOperation.next(t,n,e),this.done=this._queryOperation.done,this.success=this._queryOperation.success},n}(i.BaseOperation),a=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.next=function(n,e,r){t.prototype.next.call(this,n,e,r),this.success=!this.success},n}(c),p=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.init=function(){var t=this;this._ops=this.params.map((function(n){return i.createQueryOperation(n,null,t.options)}))},n.prototype.reset=function(){this.done=!1,this.success=!1;for(var t=0,n=this._ops.length;t<n;t++)this._ops[t].reset()},n.prototype.next=function(t,n,e){for(var r=!1,o=!1,i=0,u=this._ops.length;i<u;i++){var s=this._ops[i];if(s.next(t,n,e),s.success){r=!0,o=s.success;break}}this.success=o,this.done=r},n}(i.BaseOperation),f=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.next=function(n,e,r){t.prototype.next.call(this,n,e,r),this.success=!this.success},n}(p),l=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.next=function(t,n,e){e.hasOwnProperty(n)===this.params&&(this.done=!0,this.success=!0)},n}(i.BaseOperation),h=function(t){function n(n,e,r){return t.call(this,n,e,r,n.map((function(t){return i.createQueryOperation(t,e,r)})))||this}return o(n,t),n.prototype.next=function(t,n,e){this.childrenNext(t,n,e)},n}(i.GroupOperation);n.$eq=function(t,n,e){return new i.EqualsOperation(t,n,e)},n.$ne=function(t,n,e){return new s(t,n,e)},n.$or=function(t,n,e){return new p(t,n,e)},n.$nor=function(t,n,e){return new f(t,n,e)},n.$elemMatch=function(t,n,e){return new c(t,n,e)},n.$nin=function(t,n,e){return new f(t,n,e)},n.$in=function(t,n,e){return new p(t,n,e)},n.$lt=i.numericalOperationCreator((function(t,n,e){return new i.EqualsOperation((function(n){return n<t}),n,e)})),n.$lte=i.numericalOperationCreator((function(t,n,e){return new i.EqualsOperation((function(n){return n<=t}),n,e)})),n.$gt=i.numericalOperationCreator((function(t,n,e){return new i.EqualsOperation((function(n){return n>t}),n,e)})),n.$gte=i.numericalOperationCreator((function(t,n,e){return new i.EqualsOperation((function(n){return n>=t}),n,e)})),n.$mod=function(t,n,e){var r=t[0],o=t[1];return new i.EqualsOperation((function(t){return u.comparable(t)%r===o}),n,e)},n.$exists=function(t,n,e){return new l(t,n,e)},n.$regex=function(t,n,e){return new i.EqualsOperation(new RegExp(t,n.$options),n,e)},n.$not=function(t,n,e){return new a(t,n,e)},n.$type=function(t,n,e){return new i.EqualsOperation((function(n){return null!=n&&(n instanceof t||n.constructor===t)}),n,e)},n.$and=function(t,n,e){return new h(t,n,e)},n.$all=n.$and,n.$size=function(t,n,e){return new i.EqualsOperation((function(n){return n&&n.length===t}),n,e)},n.$options=function(){return null},n.$where=function(t,n,e){var r;if(!u.isFunction(t))throw new Error('In CSP mode, sift does not support strings in "$where" condition');return r=t,new i.EqualsOperation((function(t){return r.bind(t)(t)}),n,e)}}])})); | ||
//# sourceMappingURL=sift.csp.min.js.map |
654
sift.min.js
@@ -1,652 +0,2 @@ | ||
!(function(t, n) { | ||
"object" == typeof exports && "object" == typeof module | ||
? (module.exports = n()) | ||
: "function" == typeof define && define.amd | ||
? define([], n) | ||
: "object" == typeof exports | ||
? (exports.sift = n()) | ||
: (t.sift = n()); | ||
})(this, function() { | ||
return (function(t) { | ||
var n = {}; | ||
function e(r) { | ||
if (n[r]) return n[r].exports; | ||
var o = (n[r] = { i: r, l: !1, exports: {} }); | ||
return t[r].call(o.exports, o, o.exports, e), (o.l = !0), o.exports; | ||
} | ||
return ( | ||
(e.m = t), | ||
(e.c = n), | ||
(e.d = function(t, n, r) { | ||
e.o(t, n) || Object.defineProperty(t, n, { enumerable: !0, get: r }); | ||
}), | ||
(e.r = function(t) { | ||
"undefined" != typeof Symbol && | ||
Symbol.toStringTag && | ||
Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), | ||
Object.defineProperty(t, "__esModule", { value: !0 }); | ||
}), | ||
(e.t = function(t, n) { | ||
if ((1 & n && (t = e(t)), 8 & n)) return t; | ||
if (4 & n && "object" == typeof t && t && t.__esModule) return t; | ||
var r = Object.create(null); | ||
if ( | ||
(e.r(r), | ||
Object.defineProperty(r, "default", { enumerable: !0, value: t }), | ||
2 & n && "string" != typeof t) | ||
) | ||
for (var o in t) | ||
e.d( | ||
r, | ||
o, | ||
function(n) { | ||
return t[n]; | ||
}.bind(null, o) | ||
); | ||
return r; | ||
}), | ||
(e.n = function(t) { | ||
var n = | ||
t && t.__esModule | ||
? function() { | ||
return t.default; | ||
} | ||
: function() { | ||
return t; | ||
}; | ||
return e.d(n, "a", n), n; | ||
}), | ||
(e.o = function(t, n) { | ||
return Object.prototype.hasOwnProperty.call(t, n); | ||
}), | ||
(e.p = ""), | ||
e((e.s = 2)) | ||
); | ||
})([ | ||
function(t, n, e) { | ||
"use strict"; | ||
var r, | ||
o = | ||
(this && this.__extends) || | ||
((r = function(t, n) { | ||
return (r = | ||
Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && | ||
function(t, n) { | ||
t.__proto__ = n; | ||
}) || | ||
function(t, n) { | ||
for (var e in n) n.hasOwnProperty(e) && (t[e] = n[e]); | ||
})(t, n); | ||
}), | ||
function(t, n) { | ||
function e() { | ||
this.constructor = t; | ||
} | ||
r(t, n), | ||
(t.prototype = | ||
null === n | ||
? Object.create(n) | ||
: ((e.prototype = n.prototype), new e())); | ||
}), | ||
i = | ||
(this && this.__spreadArrays) || | ||
function() { | ||
for (var t = 0, n = 0, e = arguments.length; n < e; n++) | ||
t += arguments[n].length; | ||
var r = Array(t), | ||
o = 0; | ||
for (n = 0; n < e; n++) | ||
for (var i = arguments[n], u = 0, s = i.length; u < s; u++, o++) | ||
r[o] = i[u]; | ||
return r; | ||
}; | ||
Object.defineProperty(n, "__esModule", { value: !0 }); | ||
var u = e(1), | ||
s = function(t, n, e, r, o, i) { | ||
var c = n[r]; | ||
if (u.isArray(t) && isNaN(Number(c))) | ||
for (var a = 0, p = t.length; a < p; a++) | ||
if (!s(t[a], n, e, r, a, t)) return !1; | ||
return r === n.length || null == t | ||
? e(t, o, i) | ||
: s(t[c], n, e, r + 1, c, t); | ||
}, | ||
c = (function() { | ||
function t(t, n, e) { | ||
(this.params = t), | ||
(this.owneryQuery = n), | ||
(this.options = e), | ||
this.init(); | ||
} | ||
return ( | ||
(t.prototype.init = function() {}), | ||
(t.prototype.reset = function() { | ||
(this.done = !1), (this.success = !1); | ||
}), | ||
t | ||
); | ||
})(); | ||
n.BaseOperation = c; | ||
var a = (function(t) { | ||
function n(n, e, r, o) { | ||
var i = t.call(this, n, e, r) || this; | ||
return (i._children = o), i; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.reset = function() { | ||
(this.success = !1), (this.done = !1); | ||
for (var t = 0, n = this._children.length; t < n; t++) | ||
this._children[t].reset(); | ||
}), | ||
(n.prototype.childrenNext = function(t, n, e) { | ||
for ( | ||
var r = !0, o = !0, i = 0, u = this._children.length; | ||
i < u; | ||
i++ | ||
) { | ||
var s = this._children[i]; | ||
if ((s.next(t, n, e), s.success || (o = !1), s.done)) { | ||
if (!s.success) break; | ||
} else r = !1; | ||
} | ||
(this.done = r), (this.success = o); | ||
}), | ||
n | ||
); | ||
})(c); | ||
n.GroupOperation = a; | ||
var p = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function(t, n, e) { | ||
this.childrenNext(t, n, e); | ||
}), | ||
n | ||
); | ||
})(a); | ||
n.QueryOperation = p; | ||
var f = (function(t) { | ||
function n(n, e, r, o, i) { | ||
var u = t.call(this, e, r, o, i) || this; | ||
return ( | ||
(u.keyPath = n), | ||
(u._nextNestedValue = function(t, n, e) { | ||
return u.childrenNext(t, n, e), !u.done; | ||
}), | ||
u | ||
); | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function(t, n, e) { | ||
s(t, this.keyPath, this._nextNestedValue, 0, n, e); | ||
}), | ||
n | ||
); | ||
})(a); | ||
(n.NestedOperation = f), | ||
(n.createTester = function(t, n) { | ||
if (t instanceof Function) return t; | ||
if (t instanceof RegExp) | ||
return function(n) { | ||
return "string" == typeof n && t.test(n); | ||
}; | ||
var e = u.comparable(t); | ||
return function(t) { | ||
return n(e, u.comparable(t)); | ||
}; | ||
}); | ||
var l = (function(t) { | ||
function e() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(e, t), | ||
(e.prototype.init = function() { | ||
this._test = n.createTester(this.params, this.options.compare); | ||
}), | ||
(e.prototype.next = function(t, n, e) { | ||
this._test(t, n, e) && ((this.done = !0), (this.success = !0)); | ||
}), | ||
e | ||
); | ||
})(c); | ||
n.EqualsOperation = l; | ||
var h = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function() { | ||
(this.done = !0), (this.success = !1); | ||
}), | ||
n | ||
); | ||
})(c); | ||
(n.NopeOperation = h), | ||
(n.numericalOperationCreator = function(t) { | ||
return function(n, e, r) { | ||
return null == n ? new h(n, e, r) : t(n, e, r); | ||
}; | ||
}); | ||
var y = function(t, n, e, r) { | ||
var o = r.operations[t]; | ||
if (!o) throw new Error("Unsupported operation: " + t); | ||
return o(n, e, r); | ||
}, | ||
O = function(t, n, e, r) { | ||
if ( | ||
(function(t) { | ||
for (var n in t) if ("$" === n.charAt(0)) return !0; | ||
return !1; | ||
})(n) | ||
) { | ||
var o = d(n, r), | ||
i = o[0]; | ||
if (o[1].length) | ||
throw new Error( | ||
"Property queries must contain only operations, or exact objects." | ||
); | ||
return new f(t, n, e, r, i); | ||
} | ||
return new f(t, n, e, r, [new l(n, e, r)]); | ||
}; | ||
n.createQueryOperation = function(t, n, e) { | ||
var r = d(t, e), | ||
o = r[0], | ||
u = r[1], | ||
s = i([new f([], t, n, e, o)], u); | ||
return 1 === s.length ? s[0] : new p(t, n, e, s); | ||
}; | ||
var d = function(t, n) { | ||
var e = [], | ||
r = []; | ||
for (var o in (u.isVanillaObject(t) || (t = { $eq: t }), t)) | ||
if ("$" === o.charAt(0)) { | ||
var i = y(o, t[o], t, n); | ||
null != i && e.push(i); | ||
} else r.push(O(o.split("."), t[o], t, n)); | ||
return [e, r]; | ||
}; | ||
n.createQueryTester = function(t, e) { | ||
var r = void 0 === e ? {} : e, | ||
o = r.compare, | ||
i = r.operations, | ||
s = n.createQueryOperation(t, null, { | ||
compare: o || u.equals, | ||
operations: Object.assign({}, i || {}) | ||
}); | ||
return function(t, n, e) { | ||
return s.reset(), s.next(t, n, e), s.success; | ||
}; | ||
}; | ||
}, | ||
function(t, n, e) { | ||
"use strict"; | ||
Object.defineProperty(n, "__esModule", { value: !0 }), | ||
(n.typeChecker = function(t) { | ||
var n = "[object " + t + "]"; | ||
return function(t) { | ||
return r(t) === n; | ||
}; | ||
}); | ||
var r = function(t) { | ||
return Object.prototype.toString.call(t); | ||
}; | ||
(n.comparable = function(t) { | ||
return t instanceof Date | ||
? t.getTime() | ||
: n.isArray(t) | ||
? t.map(n.comparable) | ||
: t && "function" == typeof t.toJSON | ||
? t.toJSON() | ||
: t; | ||
}), | ||
(n.isArray = n.typeChecker("Array")), | ||
(n.isObject = n.typeChecker("Object")), | ||
(n.isFunction = n.typeChecker("Function")), | ||
(n.isVanillaObject = function(t) { | ||
return ( | ||
t && | ||
(t.constructor === Object || | ||
t.constructor === Array || | ||
"function Object() { [native code] }" === | ||
t.constructor.toString() || | ||
"function Array() { [native code] }" === | ||
t.constructor.toString()) && | ||
!t.toJSON | ||
); | ||
}), | ||
(n.equals = function(t, e) { | ||
if (null == t && t == e) return !0; | ||
if (t === e) return !0; | ||
if ( | ||
Object.prototype.toString.call(t) !== | ||
Object.prototype.toString.call(e) | ||
) | ||
return !1; | ||
if (n.isArray(t)) { | ||
if (t.length !== e.length) return !1; | ||
for (var r = 0, o = t.length; r < o; r++) | ||
if (!n.equals(t[r], e[r])) return !1; | ||
return !0; | ||
} | ||
if (n.isObject(t)) { | ||
if (Object.keys(t).length !== Object.keys(e).length) return !1; | ||
for (var i in t) if (!n.equals(t[i], e[i])) return !1; | ||
return !0; | ||
} | ||
return !1; | ||
}); | ||
}, | ||
function(t, n, e) { | ||
t.exports = e(3); | ||
}, | ||
function(t, n, e) { | ||
"use strict"; | ||
Object.defineProperty(n, "__esModule", { value: !0 }); | ||
var r = e(4), | ||
o = e(0); | ||
n.EqualsOperation = o.EqualsOperation; | ||
var i = function(t, n) { | ||
var e = void 0 === n ? {} : n, | ||
i = e.compare, | ||
u = e.operations; | ||
return o.createQueryTester(t, { | ||
compare: i, | ||
operations: Object.assign({}, { $and: r.$and }, u || {}) | ||
}); | ||
}; | ||
(t.exports = i), (n.default = i); | ||
}, | ||
function(t, n, e) { | ||
"use strict"; | ||
var r, | ||
o = | ||
(this && this.__extends) || | ||
((r = function(t, n) { | ||
return (r = | ||
Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && | ||
function(t, n) { | ||
t.__proto__ = n; | ||
}) || | ||
function(t, n) { | ||
for (var e in n) n.hasOwnProperty(e) && (t[e] = n[e]); | ||
})(t, n); | ||
}), | ||
function(t, n) { | ||
function e() { | ||
this.constructor = t; | ||
} | ||
r(t, n), | ||
(t.prototype = | ||
null === n | ||
? Object.create(n) | ||
: ((e.prototype = n.prototype), new e())); | ||
}); | ||
Object.defineProperty(n, "__esModule", { value: !0 }); | ||
var i = e(0), | ||
u = e(1), | ||
s = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.init = function() { | ||
this._test = i.createTester(this.params, this.options.compare); | ||
}), | ||
(n.prototype.reset = function() { | ||
t.prototype.reset.call(this), (this.success = !0); | ||
}), | ||
(n.prototype.next = function(t) { | ||
this._test(t) && ((this.done = !0), (this.success = !1)); | ||
}), | ||
n | ||
); | ||
})(i.BaseOperation), | ||
c = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.init = function() { | ||
this._queryOperation = i.createQueryOperation( | ||
this.params, | ||
this.owneryQuery, | ||
this.options | ||
); | ||
}), | ||
(n.prototype.reset = function() { | ||
this._queryOperation.reset(); | ||
}), | ||
(n.prototype.next = function(t, n, e) { | ||
this._queryOperation.next(t, n, e), | ||
(this.done = this._queryOperation.done), | ||
(this.success = this._queryOperation.success); | ||
}), | ||
n | ||
); | ||
})(i.BaseOperation), | ||
a = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function(n, e, r) { | ||
t.prototype.next.call(this, n, e, r), | ||
(this.success = !this.success); | ||
}), | ||
n | ||
); | ||
})(c), | ||
p = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.init = function() { | ||
var t = this; | ||
this._ops = this.params.map(function(n) { | ||
return i.createQueryOperation(n, null, t.options); | ||
}); | ||
}), | ||
(n.prototype.reset = function() { | ||
(this.done = !1), (this.success = !1); | ||
for (var t = 0, n = this._ops.length; t < n; t++) | ||
this._ops[t].reset(); | ||
}), | ||
(n.prototype.next = function(t, n, e) { | ||
for ( | ||
var r = !1, o = !1, i = 0, u = this._ops.length; | ||
i < u; | ||
i++ | ||
) { | ||
var s = this._ops[i]; | ||
if ((s.next(t, n, e), s.success)) { | ||
(r = !0), (o = s.success); | ||
break; | ||
} | ||
} | ||
(this.success = o), (this.done = r); | ||
}), | ||
n | ||
); | ||
})(i.BaseOperation), | ||
f = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function(n, e, r) { | ||
t.prototype.next.call(this, n, e, r), | ||
(this.success = !this.success); | ||
}), | ||
n | ||
); | ||
})(p), | ||
l = (function(t) { | ||
function n() { | ||
return (null !== t && t.apply(this, arguments)) || this; | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function(t, n, e) { | ||
e.hasOwnProperty(n) === this.params && | ||
((this.done = !0), (this.success = !0)); | ||
}), | ||
n | ||
); | ||
})(i.BaseOperation), | ||
h = (function(t) { | ||
function n(n, e, r) { | ||
return ( | ||
t.call( | ||
this, | ||
n, | ||
e, | ||
r, | ||
n.map(function(t) { | ||
return i.createQueryOperation(t, e, r); | ||
}) | ||
) || this | ||
); | ||
} | ||
return ( | ||
o(n, t), | ||
(n.prototype.next = function(t, n, e) { | ||
this.childrenNext(t, n, e); | ||
}), | ||
n | ||
); | ||
})(i.GroupOperation); | ||
(n.$eq = function(t, n, e) { | ||
return new i.EqualsOperation(t, n, e); | ||
}), | ||
(n.$ne = function(t, n, e) { | ||
return new s(t, n, e); | ||
}), | ||
(n.$or = function(t, n, e) { | ||
return new p(t, n, e); | ||
}), | ||
(n.$nor = function(t, n, e) { | ||
return new f(t, n, e); | ||
}), | ||
(n.$elemMatch = function(t, n, e) { | ||
return new c(t, n, e); | ||
}), | ||
(n.$nin = function(t, n, e) { | ||
return new f(t, n, e); | ||
}), | ||
(n.$in = function(t, n, e) { | ||
return new p(t, n, e); | ||
}), | ||
(n.$lt = i.numericalOperationCreator(function(t, n, e) { | ||
return new i.EqualsOperation( | ||
function(n) { | ||
return n < t; | ||
}, | ||
n, | ||
e | ||
); | ||
})), | ||
(n.$lte = i.numericalOperationCreator(function(t, n, e) { | ||
return new i.EqualsOperation( | ||
function(n) { | ||
return n <= t; | ||
}, | ||
n, | ||
e | ||
); | ||
})), | ||
(n.$gt = i.numericalOperationCreator(function(t, n, e) { | ||
return new i.EqualsOperation( | ||
function(n) { | ||
return n > t; | ||
}, | ||
n, | ||
e | ||
); | ||
})), | ||
(n.$gte = i.numericalOperationCreator(function(t, n, e) { | ||
return new i.EqualsOperation( | ||
function(n) { | ||
return n >= t; | ||
}, | ||
n, | ||
e | ||
); | ||
})), | ||
(n.$mod = function(t, n, e) { | ||
var r = t[0], | ||
o = t[1]; | ||
return new i.EqualsOperation( | ||
function(t) { | ||
return u.comparable(t) % r === o; | ||
}, | ||
n, | ||
e | ||
); | ||
}), | ||
(n.$exists = function(t, n, e) { | ||
return new l(t, n, e); | ||
}), | ||
(n.$regex = function(t, n, e) { | ||
return new i.EqualsOperation(new RegExp(t, n.$options), n, e); | ||
}), | ||
(n.$not = function(t, n, e) { | ||
return new a(t, n, e); | ||
}), | ||
(n.$type = function(t, n, e) { | ||
return new i.EqualsOperation( | ||
function(n) { | ||
return null != n && (n instanceof t || n.constructor === t); | ||
}, | ||
n, | ||
e | ||
); | ||
}), | ||
(n.$and = function(t, n, e) { | ||
return new h(t, n, e); | ||
}), | ||
(n.$all = n.$and), | ||
(n.$size = function(t, n, e) { | ||
return new i.EqualsOperation( | ||
function(n) { | ||
return n && n.length === t; | ||
}, | ||
n, | ||
e | ||
); | ||
}), | ||
(n.$options = function() { | ||
return null; | ||
}), | ||
(n.$where = function(t, n, e) { | ||
var r; | ||
return ( | ||
(r = u.isFunction(t) ? t : new Function("obj", "return " + t)), | ||
new i.EqualsOperation( | ||
function(t) { | ||
return r.bind(t)(t); | ||
}, | ||
n, | ||
e | ||
) | ||
); | ||
}); | ||
} | ||
]); | ||
}); | ||
//# sourceMappingURL=sift.min.js.map | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.sift=n():t.sift=n()}(this,(function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=2)}([function(t,n,e){"use strict";var r,o=this&&this.__extends||(r=function(t,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)},function(t,n){function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),i=this&&this.__spreadArrays||function(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;var r=Array(t),o=0;for(n=0;n<e;n++)for(var i=arguments[n],u=0,s=i.length;u<s;u++,o++)r[o]=i[u];return r};Object.defineProperty(n,"__esModule",{value:!0});var u=e(1),s=function(t,n,e,r,o,i){var c=n[r];if(u.isArray(t)&&isNaN(Number(c)))for(var a=0,p=t.length;a<p;a++)if(!s(t[a],n,e,r,a,t))return!1;return r===n.length||null==t?e(t,o,i):s(t[c],n,e,r+1,c,t)},c=function(){function t(t,n,e){this.params=t,this.owneryQuery=n,this.options=e,this.init()}return t.prototype.init=function(){},t.prototype.reset=function(){this.done=!1,this.success=!1},t}();n.BaseOperation=c;var a=function(t){function n(n,e,r,o){var i=t.call(this,n,e,r)||this;return i._children=o,i}return o(n,t),n.prototype.reset=function(){this.success=!1,this.done=!1;for(var t=0,n=this._children.length;t<n;t++)this._children[t].reset()},n.prototype.childrenNext=function(t,n,e){for(var r=!0,o=!0,i=0,u=this._children.length;i<u;i++){var s=this._children[i];if(s.next(t,n,e),s.success||(o=!1),s.done){if(!s.success)break}else r=!1}this.done=r,this.success=o},n}(c);n.GroupOperation=a;var p=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.next=function(t,n,e){this.childrenNext(t,n,e)},n}(a);n.QueryOperation=p;var f=function(t){function n(n,e,r,o,i){var u=t.call(this,e,r,o,i)||this;return u.keyPath=n,u._nextNestedValue=function(t,n,e){return u.childrenNext(t,n,e),!u.done},u}return o(n,t),n.prototype.next=function(t,n,e){s(t,this.keyPath,this._nextNestedValue,0,n,e)},n}(a);n.NestedOperation=f,n.createTester=function(t,n){if(t instanceof Function)return t;if(t instanceof RegExp)return function(n){return"string"==typeof n&&t.test(n)};var e=u.comparable(t);return function(t){return n(e,u.comparable(t))}};var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.init=function(){this._test=n.createTester(this.params,this.options.compare)},e.prototype.next=function(t,n,e){this._test(t,n,e)&&(this.done=!0,this.success=!0)},e}(c);n.EqualsOperation=l;var h=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.next=function(){this.done=!0,this.success=!1},n}(c);n.NopeOperation=h,n.numericalOperationCreator=function(t){return function(n,e,r){return null==n?new h(n,e,r):t(n,e,r)}};var y=function(t,n,e,r){var o=r.operations[t];if(!o)throw new Error("Unsupported operation: "+t);return o(n,e,r)},O=function(t,n,e,r){if(function(t){for(var n in t)if("$"===n.charAt(0))return!0;return!1}(n)){var o=d(n,r),i=o[0];if(o[1].length)throw new Error("Property queries must contain only operations, or exact objects.");return new f(t,n,e,r,i)}return new f(t,n,e,r,[new l(n,e,r)])};n.createQueryOperation=function(t,n,e){var r=d(t,e),o=r[0],u=r[1],s=i([new f([],t,n,e,o)],u);return 1===s.length?s[0]:new p(t,n,e,s)};var d=function(t,n){var e=[],r=[];for(var o in u.isVanillaObject(t)||(t={$eq:t}),t)if("$"===o.charAt(0)){var i=y(o,t[o],t,n);null!=i&&e.push(i)}else r.push(O(o.split("."),t[o],t,n));return[e,r]};n.createQueryTester=function(t,e){var r=void 0===e?{}:e,o=r.compare,i=r.operations,s=n.createQueryOperation(t,null,{compare:o||u.equals,operations:Object.assign({},i||{})});return function(t,n,e){return s.reset(),s.next(t,n,e),s.success}}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.typeChecker=function(t){var n="[object "+t+"]";return function(t){return r(t)===n}};var r=function(t){return Object.prototype.toString.call(t)};n.comparable=function(t){return t instanceof Date?t.getTime():n.isArray(t)?t.map(n.comparable):t&&"function"==typeof t.toJSON?t.toJSON():t},n.isArray=n.typeChecker("Array"),n.isObject=n.typeChecker("Object"),n.isFunction=n.typeChecker("Function"),n.isVanillaObject=function(t){return t&&(t.constructor===Object||t.constructor===Array||"function Object() { [native code] }"===t.constructor.toString()||"function Array() { [native code] }"===t.constructor.toString())&&!t.toJSON},n.equals=function(t,e){if(null==t&&t==e)return!0;if(t===e)return!0;if(Object.prototype.toString.call(t)!==Object.prototype.toString.call(e))return!1;if(n.isArray(t)){if(t.length!==e.length)return!1;for(var r=0,o=t.length;r<o;r++)if(!n.equals(t[r],e[r]))return!1;return!0}if(n.isObject(t)){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var i in t)if(!n.equals(t[i],e[i]))return!1;return!0}return!1}},function(t,n,e){t.exports=e(3)},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e(4),o=e(0);n.EqualsOperation=o.EqualsOperation;var i=function(t,n){var e=void 0===n?{}:n,i=e.compare,u=e.operations;return o.createQueryTester(t,{compare:i,operations:Object.assign({},r,u||{})})};t.exports=i,n.default=i},function(t,n,e){"use strict";var r,o=this&&this.__extends||(r=function(t,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)},function(t,n){function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)});Object.defineProperty(n,"__esModule",{value:!0});var i=e(0),u=e(1),s=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.init=function(){this._test=i.createTester(this.params,this.options.compare)},n.prototype.reset=function(){t.prototype.reset.call(this),this.success=!0},n.prototype.next=function(t){this._test(t)&&(this.done=!0,this.success=!1)},n}(i.BaseOperation),c=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.init=function(){this._queryOperation=i.createQueryOperation(this.params,this.owneryQuery,this.options)},n.prototype.reset=function(){this._queryOperation.reset()},n.prototype.next=function(t,n,e){this._queryOperation.next(t,n,e),this.done=this._queryOperation.done,this.success=this._queryOperation.success},n}(i.BaseOperation),a=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.next=function(n,e,r){t.prototype.next.call(this,n,e,r),this.success=!this.success},n}(c),p=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.init=function(){var t=this;this._ops=this.params.map((function(n){return i.createQueryOperation(n,null,t.options)}))},n.prototype.reset=function(){this.done=!1,this.success=!1;for(var t=0,n=this._ops.length;t<n;t++)this._ops[t].reset()},n.prototype.next=function(t,n,e){for(var r=!1,o=!1,i=0,u=this._ops.length;i<u;i++){var s=this._ops[i];if(s.next(t,n,e),s.success){r=!0,o=s.success;break}}this.success=o,this.done=r},n}(i.BaseOperation),f=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.next=function(n,e,r){t.prototype.next.call(this,n,e,r),this.success=!this.success},n}(p),l=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return o(n,t),n.prototype.next=function(t,n,e){e.hasOwnProperty(n)===this.params&&(this.done=!0,this.success=!0)},n}(i.BaseOperation),h=function(t){function n(n,e,r){return t.call(this,n,e,r,n.map((function(t){return i.createQueryOperation(t,e,r)})))||this}return o(n,t),n.prototype.next=function(t,n,e){this.childrenNext(t,n,e)},n}(i.GroupOperation);n.$eq=function(t,n,e){return new i.EqualsOperation(t,n,e)},n.$ne=function(t,n,e){return new s(t,n,e)},n.$or=function(t,n,e){return new p(t,n,e)},n.$nor=function(t,n,e){return new f(t,n,e)},n.$elemMatch=function(t,n,e){return new c(t,n,e)},n.$nin=function(t,n,e){return new f(t,n,e)},n.$in=function(t,n,e){return new p(t,n,e)},n.$lt=i.numericalOperationCreator((function(t,n,e){return new i.EqualsOperation((function(n){return n<t}),n,e)})),n.$lte=i.numericalOperationCreator((function(t,n,e){return new i.EqualsOperation((function(n){return n<=t}),n,e)})),n.$gt=i.numericalOperationCreator((function(t,n,e){return new i.EqualsOperation((function(n){return n>t}),n,e)})),n.$gte=i.numericalOperationCreator((function(t,n,e){return new i.EqualsOperation((function(n){return n>=t}),n,e)})),n.$mod=function(t,n,e){var r=t[0],o=t[1];return new i.EqualsOperation((function(t){return u.comparable(t)%r===o}),n,e)},n.$exists=function(t,n,e){return new l(t,n,e)},n.$regex=function(t,n,e){return new i.EqualsOperation(new RegExp(t,n.$options),n,e)},n.$not=function(t,n,e){return new a(t,n,e)},n.$type=function(t,n,e){return new i.EqualsOperation((function(n){return null!=n&&(n instanceof t||n.constructor===t)}),n,e)},n.$and=function(t,n,e){return new h(t,n,e)},n.$all=n.$and,n.$size=function(t,n,e){return new i.EqualsOperation((function(n){return n&&n.length===t}),n,e)},n.$options=function(){return null},n.$where=function(t,n,e){var r;return r=u.isFunction(t)?t:new Function("obj","return "+t),new i.EqualsOperation((function(t){return r.bind(t)(t)}),n,e)}}])})); | ||
//# sourceMappingURL=sift.min.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34
362976
2796
456