sift
Advanced tools
Comparing version 13.5.0 to 13.5.1
@@ -454,3 +454,19 @@ const typeChecker = (type) => { | ||
const $not = (params, owneryQuery, options, name) => new $Not(params, owneryQuery, options, name); | ||
const $type = (clazz, owneryQuery, options) => new EqualsOperation(b => (b != null ? b instanceof clazz || b.constructor === clazz : false), owneryQuery, options); | ||
const typeAliases = { | ||
number: v => typeof v === "number", | ||
string: v => typeof v === "string", | ||
bool: v => typeof v === "boolean", | ||
array: v => Array.isArray(v), | ||
null: v => v === null, | ||
timestamp: v => v instanceof Date | ||
}; | ||
const $type = (clazz, owneryQuery, options) => new EqualsOperation(b => { | ||
if (typeof clazz === "string") { | ||
if (!typeAliases[clazz]) { | ||
throw new Error(`Type alias does not exist`); | ||
} | ||
return typeAliases[clazz](b); | ||
} | ||
return b != null ? b instanceof clazz || b.constructor === clazz : false; | ||
}, owneryQuery, options); | ||
const $and = (params, ownerQuery, options, name) => new $And(params, ownerQuery, options, name); | ||
@@ -457,0 +473,0 @@ const $all = $and; |
@@ -574,4 +574,20 @@ /*! ***************************************************************************** | ||
var $not = function (params, owneryQuery, options, name) { return new $Not(params, owneryQuery, options, name); }; | ||
var typeAliases = { | ||
number: function (v) { return typeof v === "number"; }, | ||
string: function (v) { return typeof v === "string"; }, | ||
bool: function (v) { return typeof v === "boolean"; }, | ||
array: function (v) { return Array.isArray(v); }, | ||
null: function (v) { return v === null; }, | ||
timestamp: function (v) { return v instanceof Date; } | ||
}; | ||
var $type = function (clazz, owneryQuery, options) { | ||
return new EqualsOperation(function (b) { return (b != null ? b instanceof clazz || b.constructor === clazz : false); }, owneryQuery, options); | ||
return new EqualsOperation(function (b) { | ||
if (typeof clazz === "string") { | ||
if (!typeAliases[clazz]) { | ||
throw new Error("Type alias does not exist"); | ||
} | ||
return typeAliases[clazz](b); | ||
} | ||
return b != null ? b instanceof clazz || b.constructor === clazz : false; | ||
}, owneryQuery, options); | ||
}; | ||
@@ -578,0 +594,0 @@ var $and = function (params, ownerQuery, options, name) { return new $And(params, ownerQuery, options, name); }; |
@@ -113,4 +113,4 @@ import { Key, Comparator } from "./utils"; | ||
export declare const createQueryOperation: <TItem, TSchema = TItem>(query: Query<TSchema>, owneryQuery?: any, { compare, operations }?: Partial<Options>) => QueryOperation<TItem>; | ||
export declare const createOperationTester: <TItem>(operation: Operation<TItem>) => (item: TItem, key?: Key, owner?: any) => boolean; | ||
export declare const createQueryTester: <TItem, TSchema = TItem>(query: Query<TSchema>, options?: Partial<Options>) => (item: TItem, key?: Key, owner?: any) => boolean; | ||
export declare const createOperationTester: <TItem>(operation: Operation<TItem>) => (item: TItem, key?: string | number, owner?: any) => boolean; | ||
export declare const createQueryTester: <TItem, TSchema = TItem>(query: Query<TSchema>, options?: Partial<Options>) => (item: TItem, key?: string | number, owner?: any) => boolean; | ||
export {}; |
@@ -580,4 +580,20 @@ (function (global, factory) { | ||
var $not = function (params, owneryQuery, options, name) { return new $Not(params, owneryQuery, options, name); }; | ||
var typeAliases = { | ||
number: function (v) { return typeof v === "number"; }, | ||
string: function (v) { return typeof v === "string"; }, | ||
bool: function (v) { return typeof v === "boolean"; }, | ||
array: function (v) { return Array.isArray(v); }, | ||
null: function (v) { return v === null; }, | ||
timestamp: function (v) { return v instanceof Date; } | ||
}; | ||
var $type = function (clazz, owneryQuery, options) { | ||
return new EqualsOperation(function (b) { return (b != null ? b instanceof clazz || b.constructor === clazz : false); }, owneryQuery, options); | ||
return new EqualsOperation(function (b) { | ||
if (typeof clazz === "string") { | ||
if (!typeAliases[clazz]) { | ||
throw new Error("Type alias does not exist"); | ||
} | ||
return typeAliases[clazz](b); | ||
} | ||
return b != null ? b instanceof clazz || b.constructor === clazz : false; | ||
}, owneryQuery, options); | ||
}; | ||
@@ -584,0 +600,0 @@ var $and = function (params, ownerQuery, options, name) { return new $And(params, ownerQuery, options, name); }; |
@@ -49,9 +49,9 @@ import { NamedBaseOperation, EqualsOperation, Options, Operation, Query, NamedGroupOperation } from "./core"; | ||
} | ||
export declare const $eq: (params: any, owneryQuery: Query<any>, options: Options) => EqualsOperation<any>; | ||
export declare const $ne: (params: any, owneryQuery: Query<any>, options: Options, name: string) => $Ne; | ||
export declare const $or: (params: Query<any>[], owneryQuery: Query<any>, options: Options, name: string) => $Or; | ||
export declare const $nor: (params: Query<any>[], owneryQuery: Query<any>, options: Options, name: string) => $Nor; | ||
export declare const $elemMatch: (params: any, owneryQuery: Query<any>, options: Options, name: string) => $ElemMatch; | ||
export declare const $nin: (params: any, owneryQuery: Query<any>, options: Options, name: string) => $Nin; | ||
export declare const $in: (params: any, owneryQuery: Query<any>, options: Options, name: string) => $In; | ||
export declare const $eq: (params: any, owneryQuery: any, options: Options) => EqualsOperation<any>; | ||
export declare const $ne: (params: any, owneryQuery: any, options: Options, name: string) => $Ne; | ||
export declare const $or: (params: any[], owneryQuery: any, options: Options, name: string) => $Or; | ||
export declare const $nor: (params: any[], owneryQuery: any, options: Options, name: string) => $Nor; | ||
export declare const $elemMatch: (params: any, owneryQuery: any, options: Options, name: string) => $ElemMatch; | ||
export declare const $nin: (params: any, owneryQuery: any, options: Options, name: string) => $Nin; | ||
export declare const $in: (params: any, owneryQuery: any, options: Options, name: string) => $In; | ||
export declare const $lt: (params: any, owneryQuery: any, options: Options, name: string) => Operation<any> | import("./core").NopeOperation<any>; | ||
@@ -61,12 +61,12 @@ export declare const $lte: (params: any, owneryQuery: any, options: Options, name: string) => Operation<any> | import("./core").NopeOperation<any>; | ||
export declare const $gte: (params: any, owneryQuery: any, options: Options, name: string) => Operation<any> | import("./core").NopeOperation<any>; | ||
export declare const $mod: ([mod, equalsValue]: number[], owneryQuery: Query<any>, options: Options) => EqualsOperation<(b: any) => boolean>; | ||
export declare const $exists: (params: boolean, owneryQuery: Query<any>, options: Options, name: string) => $Exists; | ||
export declare const $regex: (pattern: string, owneryQuery: Query<any>, options: Options) => EqualsOperation<RegExp>; | ||
export declare const $not: (params: any, owneryQuery: Query<any>, options: Options, name: string) => $Not; | ||
export declare const $type: (clazz: Function, owneryQuery: Query<any>, options: Options) => EqualsOperation<(b: any) => boolean>; | ||
export declare const $and: (params: Query<any>[], ownerQuery: Query<any>, options: Options, name: string) => $And; | ||
export declare const $all: (params: Query<any>[], ownerQuery: Query<any>, options: Options, name: string) => $And; | ||
export declare const $size: (params: number, ownerQuery: Query<any>, options: Options) => $Size; | ||
export declare const $mod: ([mod, equalsValue]: number[], owneryQuery: any, options: Options) => EqualsOperation<(b: any) => boolean>; | ||
export declare const $exists: (params: boolean, owneryQuery: any, options: Options, name: string) => $Exists; | ||
export declare const $regex: (pattern: string, owneryQuery: any, options: Options) => EqualsOperation<RegExp>; | ||
export declare const $not: (params: any, owneryQuery: any, options: Options, name: string) => $Not; | ||
export declare const $type: (clazz: TimerHandler, owneryQuery: any, options: Options) => EqualsOperation<(b: any) => any>; | ||
export declare const $and: (params: any[], ownerQuery: any, options: Options, name: string) => $And; | ||
export declare const $all: (params: any[], ownerQuery: any, options: Options, name: string) => $And; | ||
export declare const $size: (params: number, ownerQuery: any, options: Options) => $Size; | ||
export declare const $options: () => any; | ||
export declare const $where: (params: string | Function, ownerQuery: Query<any>, options: Options) => EqualsOperation<(b: any) => any>; | ||
export declare const $where: (params: TimerHandler, ownerQuery: any, options: Options) => EqualsOperation<(b: any) => any>; | ||
export {}; |
{ | ||
"name": "sift", | ||
"description": "MongoDB query filtering in JavaScript", | ||
"version": "13.5.0", | ||
"version": "13.5.1", | ||
"repository": "crcn/sift.js", | ||
@@ -6,0 +6,0 @@ "sideEffects": false, |
@@ -580,4 +580,20 @@ (function (global, factory) { | ||
var $not = function (params, owneryQuery, options, name) { return new $Not(params, owneryQuery, options, name); }; | ||
var typeAliases = { | ||
number: function (v) { return typeof v === "number"; }, | ||
string: function (v) { return typeof v === "string"; }, | ||
bool: function (v) { return typeof v === "boolean"; }, | ||
array: function (v) { return Array.isArray(v); }, | ||
null: function (v) { return v === null; }, | ||
timestamp: function (v) { return v instanceof Date; } | ||
}; | ||
var $type = function (clazz, owneryQuery, options) { | ||
return new EqualsOperation(function (b) { return (b != null ? b instanceof clazz || b.constructor === clazz : false); }, owneryQuery, options); | ||
return new EqualsOperation(function (b) { | ||
if (typeof clazz === "string") { | ||
if (!typeAliases[clazz]) { | ||
throw new Error("Type alias does not exist"); | ||
} | ||
return typeAliases[clazz](b); | ||
} | ||
return b != null ? b instanceof clazz || b.constructor === clazz : false; | ||
}, owneryQuery, options); | ||
}; | ||
@@ -584,0 +600,0 @@ var $and = function (params, ownerQuery, options, name) { return new $And(params, ownerQuery, options, name); }; |
@@ -15,3 +15,3 @@ !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).sift={})}(this,(function(n){"use strict"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var t=function(n,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])})(n,i)};function i(n,i){function r(){this.constructor=n}t(n,i),n.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}var r=function(n){var t="[object "+n+"]";return function(n){return u(n)===t}},u=function(n){return Object.prototype.toString.call(n)},e=function(n){return n instanceof Date?n.getTime():o(n)?n.map(e):n&&"function"==typeof n.toJSON?n.toJSON():n},o=r("Array"),f=r("Object"),c=r("Function"),s=function(n,t){if(null==n&&n==t)return!0;if(n===t)return!0;if(Object.prototype.toString.call(n)!==Object.prototype.toString.call(t))return!1;if(o(n)){if(n.length!==t.length)return!1;for(var i=0,r=n.length;i<r;i++)if(!s(n[i],t[i]))return!1;return!0}if(f(n)){if(Object.keys(n).length!==Object.keys(t).length)return!1;for(var u in n)if(!s(n[u],t[u]))return!1;return!0}return!1},h=function(n,t,i,r,u,e){var f=t[r];if(o(n)&&isNaN(Number(f)))for(var c=0,s=n.length;c<s;c++)if(!h(n[c],t,i,r,c,n))return!1;return r===t.length||null==n?i(n,u,e):h(n[f],t,i,r+1,f,n)},a=function(){function n(n,t,i){this.params=n,this.owneryQuery=t,this.options=i,this.init()}return n.prototype.init=function(){},n.prototype.reset=function(){this.done=!1,this.keep=!1},n}(),l=function(n){function t(t,i,r,u){var e=n.call(this,t,i,r)||this;return e.name=u,e}return i(t,n),t}(a),v=function(n){function t(t,i,r,u){var e=n.call(this,t,i,r)||this;return e.children=u,e}return i(t,n),t.prototype.reset=function(){this.keep=!1,this.done=!1;for(var n=0,t=this.children.length;n<t;n++)this.children[n].reset()},t.prototype.childrenNext=function(n,t,i){for(var r=!0,u=!0,e=0,o=this.children.length;e<o;e++){var f=this.children[e];if(f.next(n,t,i),f.keep||(u=!1),f.done){if(!f.keep)break}else r=!1}this.done=r,this.keep=u},t}(a),w=function(n){function t(t,i,r,u,e){var o=n.call(this,t,i,r,u)||this;return o.name=e,o}return i(t,n),t}(v),p=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return i(t,n),t.prototype.next=function(n,t,i){this.childrenNext(n,t,i)},t}(v),$=function(n){function t(t,i,r,u,e){var o=n.call(this,i,r,u,e)||this;return o.keyPath=t,o.t=function(n,t,i){return o.childrenNext(n,t,i),!o.done},o}return i(t,n),t.prototype.next=function(n,t,i){h(n,this.keyPath,this.t,0,t,i)},t}(v),b=function(n,t){if(n instanceof Function)return n;if(n instanceof RegExp)return function(t){var i="string"==typeof t&&n.test(t);return n.lastIndex=0,i};var i=e(n);return function(n){return t(i,e(n))}},d=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return i(t,n),t.prototype.init=function(){this.i=b(this.params,this.options.compare)},t.prototype.next=function(n,t,i){Array.isArray(i)&&!i.hasOwnProperty(t)||this.i(n,t,i)&&(this.done=!0,this.keep=!0)},t}(a),j=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return i(t,n),t.prototype.next=function(){this.done=!0,this.keep=!1},t}(a),y=function(n){return t=function(t,i,r){var u=typeof e(t),o=n(t);return new d((function(n){return typeof e(n)===u&&o(n)}),i,r)},function(n,i,r,u){return null==n?new j(n,i,r):t(n,i,r,u)};var t},O=function(n,t,i,r){var u=r.operations[n];if(!u)throw new Error("Unsupported operation: "+n);return u(t,i,r,n)},_=function(n){for(var t in n)if("$"===t.charAt(0))return!0;return!1},m=function(n,t,i,r){if(_(t)){var u=g(t,r),e=u[0];if(u[1].length)throw new Error("Property queries must contain only operations, or exact objects.");return new $(n,t,i,r,e)}return new $(n,t,i,r,[new d(t,i,r)])},x=function(n,t,i){void 0===t&&(t=null);var r=void 0===i?{}:i,u=r.compare,e=r.operations,o={compare:u||s,operations:Object.assign({},e||{})},f=g(n,o),c=f[0],h=f[1],a=[];return c.length&&a.push(new $([],n,t,o,c)),a.push.apply(a,h),1===a.length?a[0]:new p(n,t,o,a)},g=function(n,t){var i,r=[],u=[];if(!(i=n)||i.constructor!==Object&&i.constructor!==Array&&"function Object() { [native code] }"!==i.constructor.toString()&&"function Array() { [native code] }"!==i.constructor.toString()||i.toJSON)return r.push(new d(n,n,t)),[r,u];for(var e in n)if("$"===e.charAt(0)){var o=O(e,n[e],n,t);null!=o&&r.push(o)}else u.push(m(e.split("."),n[e],n,t));return[r,u]},E=function(n){return function(t,i,r){return n.reset(),n.next(t,i,r),n.keep}},A=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return i(t,n),t.prototype.init=function(){this.i=b(this.params,this.options.compare)},t.prototype.reset=function(){n.prototype.reset.call(this),this.keep=!0},t.prototype.next=function(n){this.i(n)&&(this.done=!0,this.keep=!1)},t}(l),k=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return i(t,n),t.prototype.init=function(){this.u=x(this.params,this.owneryQuery,this.options)},t.prototype.reset=function(){n.prototype.reset.call(this),this.u.reset()},t.prototype.next=function(n){if(o(n)){for(var t=0,i=n.length;t<i;t++)this.u.reset(),this.u.next(n[t],t,n),this.keep=this.keep||this.u.keep;this.done=!0}else this.done=!1,this.keep=!1},t}(l),z=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return i(t,n),t.prototype.init=function(){this.u=x(this.params,this.owneryQuery,this.options)},t.prototype.reset=function(){this.u.reset()},t.prototype.next=function(n,t,i){this.u.next(n,t,i),this.done=this.u.done,this.keep=!this.u.keep},t}(l),F=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return i(t,n),t.prototype.init=function(){},t.prototype.next=function(n){o(n)&&n.length===this.params&&(this.done=!0,this.keep=!0)},t}(l),N=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return i(t,n),t.prototype.init=function(){var n=this;this.o=this.params.map((function(t){return x(t,null,n.options)}))},t.prototype.reset=function(){this.done=!1,this.keep=!1;for(var n=0,t=this.o.length;n<t;n++)this.o[n].reset()},t.prototype.next=function(n,t,i){for(var r=!1,u=!1,e=0,o=this.o.length;e<o;e++){var f=this.o[e];if(f.next(n,t,i),f.keep){r=!0,u=f.keep;break}}this.keep=u,this.done=r},t}(l),q=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return i(t,n),t.prototype.next=function(t,i,r){n.prototype.next.call(this,t,i,r),this.keep=!this.keep},t}(N),M=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return i(t,n),t.prototype.init=function(){var n=this;this.h=this.params.map((function(t){if(_(t))throw new Error("cannot nest $ under "+n.constructor.name.toLowerCase());return b(t,n.options.compare)}))},t.prototype.next=function(n,t,i){for(var r=!1,u=!1,e=0,o=this.h.length;e<o;e++){if((0,this.h[e])(n)){r=!0,u=!0;break}}this.keep=u,this.done=r},t}(l),P=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return i(t,n),t.prototype.next=function(t,i,r){n.prototype.next.call(this,t,i,r),this.keep=!this.keep},t}(M),R=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return i(t,n),t.prototype.next=function(n,t,i){i.hasOwnProperty(t)===this.params&&(this.done=!0,this.keep=!0)},t}(l),S=function(n){function t(t,i,r,u){return n.call(this,t,i,r,t.map((function(n){return x(n,i,r)})),u)||this}return i(t,n),t.prototype.next=function(n,t,i){this.childrenNext(n,t,i)},t}(w),C=function(n,t,i){return new d(n,t,i)},D=function(n,t,i,r){return new A(n,t,i,r)},I=function(n,t,i,r){return new N(n,t,i,r)},U=function(n,t,i,r){return new q(n,t,i,r)},B=function(n,t,i,r){return new k(n,t,i,r)},G=function(n,t,i,r){return new P(n,t,i,r)},H=function(n,t,i,r){return new M(n,t,i,r)},J=y((function(n){return function(t){return t<n}})),K=y((function(n){return function(t){return t<=n}})),L=y((function(n){return function(t){return t>n}})),Q=y((function(n){return function(t){return t>=n}})),T=function(n,t,i){var r=n[0],u=n[1];return new d((function(n){return e(n)%r===u}),t,i)},V=function(n,t,i,r){return new R(n,t,i,r)},W=function(n,t,i){return new d(new RegExp(n,t.$options),t,i)},X=function(n,t,i,r){return new z(n,t,i,r)},Y=function(n,t,i){return new d((function(t){return null!=t&&(t instanceof n||t.constructor===n)}),t,i)},Z=function(n,t,i,r){return new S(n,t,i,r)},nn=Z,tn=function(n,t,i){return new F(n,t,i,"$size")},rn=function(){return null},un=function(n,t,i){var r;if(c(n))r=n;else{if(process.env.CSP_ENABLED)throw new Error('In CSP mode, sift does not support strings in "$where" condition');r=new Function("obj","return "+n)}return new d((function(n){return r.bind(n)(n)}),t,i)},en=Object.freeze({__proto__:null,$Size:F,$eq:C,$ne:D,$or:I,$nor:U,$elemMatch:B,$nin:G,$in:H,$lt:J,$lte:K,$gt:L,$gte:Q,$mod:T,$exists:V,$regex:W,$not:X,$type:Y,$and:Z,$all:nn,$size:tn,$options:rn,$where:un}),on=function(n,t,i){var r=void 0===i?{}:i,u=r.compare,e=r.operations;return x(n,t,{compare:u,operations:Object.assign({},en,e||{})})};n.$Size=F,n.$all=nn,n.$and=Z,n.$elemMatch=B,n.$eq=C,n.$exists=V,n.$gt=L,n.$gte=Q,n.$in=H,n.$lt=J,n.$lte=K,n.$mod=T,n.$ne=D,n.$nin=G,n.$nor=U,n.$not=X,n.$options=rn,n.$or=I,n.$regex=W,n.$size=tn,n.$type=Y,n.$where=un,n.EqualsOperation=d,n.createDefaultQueryOperation=on,n.createEqualsOperation=function(n,t,i){return new d(n,t,i)},n.createOperationTester=E,n.createQueryOperation=x,n.createQueryTester=function(n,t){return void 0===t&&(t={}),E(x(n,null,t))},n.default=function(n,t){void 0===t&&(t={});var i=on(n,null,t);return E(i)},Object.defineProperty(n,"l",{value:!0})})); | ||
***************************************************************************** */var t=function(n,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r])})(n,r)};function r(n,r){function i(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var i=function(n){var t="[object "+n+"]";return function(n){return u(n)===t}},u=function(n){return Object.prototype.toString.call(n)},e=function(n){return n instanceof Date?n.getTime():o(n)?n.map(e):n&&"function"==typeof n.toJSON?n.toJSON():n},o=i("Array"),f=i("Object"),c=i("Function"),s=function(n,t){if(null==n&&n==t)return!0;if(n===t)return!0;if(Object.prototype.toString.call(n)!==Object.prototype.toString.call(t))return!1;if(o(n)){if(n.length!==t.length)return!1;for(var r=0,i=n.length;r<i;r++)if(!s(n[r],t[r]))return!1;return!0}if(f(n)){if(Object.keys(n).length!==Object.keys(t).length)return!1;for(var u in n)if(!s(n[u],t[u]))return!1;return!0}return!1},h=function(n,t,r,i,u,e){var f=t[i];if(o(n)&&isNaN(Number(f)))for(var c=0,s=n.length;c<s;c++)if(!h(n[c],t,r,i,c,n))return!1;return i===t.length||null==n?r(n,u,e):h(n[f],t,r,i+1,f,n)},a=function(){function n(n,t,r){this.params=n,this.owneryQuery=t,this.options=r,this.init()}return n.prototype.init=function(){},n.prototype.reset=function(){this.done=!1,this.keep=!1},n}(),l=function(n){function t(t,r,i,u){var e=n.call(this,t,r,i)||this;return e.name=u,e}return r(t,n),t}(a),v=function(n){function t(t,r,i,u){var e=n.call(this,t,r,i)||this;return e.children=u,e}return r(t,n),t.prototype.reset=function(){this.keep=!1,this.done=!1;for(var n=0,t=this.children.length;n<t;n++)this.children[n].reset()},t.prototype.childrenNext=function(n,t,r){for(var i=!0,u=!0,e=0,o=this.children.length;e<o;e++){var f=this.children[e];if(f.next(n,t,r),f.keep||(u=!1),f.done){if(!f.keep)break}else i=!1}this.done=i,this.keep=u},t}(a),w=function(n){function t(t,r,i,u,e){var o=n.call(this,t,r,i,u)||this;return o.name=e,o}return r(t,n),t}(v),p=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return r(t,n),t.prototype.next=function(n,t,r){this.childrenNext(n,t,r)},t}(v),$=function(n){function t(t,r,i,u,e){var o=n.call(this,r,i,u,e)||this;return o.keyPath=t,o.t=function(n,t,r){return o.childrenNext(n,t,r),!o.done},o}return r(t,n),t.prototype.next=function(n,t,r){h(n,this.keyPath,this.t,0,t,r)},t}(v),b=function(n,t){if(n instanceof Function)return n;if(n instanceof RegExp)return function(t){var r="string"==typeof t&&n.test(t);return n.lastIndex=0,r};var r=e(n);return function(n){return t(r,e(n))}},d=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return r(t,n),t.prototype.init=function(){this.i=b(this.params,this.options.compare)},t.prototype.next=function(n,t,r){Array.isArray(r)&&!r.hasOwnProperty(t)||this.i(n,t,r)&&(this.done=!0,this.keep=!0)},t}(a),y=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return r(t,n),t.prototype.next=function(){this.done=!0,this.keep=!1},t}(a),j=function(n){return t=function(t,r,i){var u=typeof e(t),o=n(t);return new d((function(n){return typeof e(n)===u&&o(n)}),r,i)},function(n,r,i,u){return null==n?new y(n,r,i):t(n,r,i,u)};var t},O=function(n,t,r,i){var u=i.operations[n];if(!u)throw new Error("Unsupported operation: "+n);return u(t,r,i,n)},m=function(n){for(var t in n)if("$"===t.charAt(0))return!0;return!1},g=function(n,t,r,i){if(m(t)){var u=x(t,i),e=u[0];if(u[1].length)throw new Error("Property queries must contain only operations, or exact objects.");return new $(n,t,r,i,e)}return new $(n,t,r,i,[new d(t,r,i)])},_=function(n,t,r){void 0===t&&(t=null);var i=void 0===r?{}:r,u=i.compare,e=i.operations,o={compare:u||s,operations:Object.assign({},e||{})},f=x(n,o),c=f[0],h=f[1],a=[];return c.length&&a.push(new $([],n,t,o,c)),a.push.apply(a,h),1===a.length?a[0]:new p(n,t,o,a)},x=function(n,t){var r,i=[],u=[];if(!(r=n)||r.constructor!==Object&&r.constructor!==Array&&"function Object() { [native code] }"!==r.constructor.toString()&&"function Array() { [native code] }"!==r.constructor.toString()||r.toJSON)return i.push(new d(n,n,t)),[i,u];for(var e in n)if("$"===e.charAt(0)){var o=O(e,n[e],n,t);null!=o&&i.push(o)}else u.push(g(e.split("."),n[e],n,t));return[i,u]},E=function(n){return function(t,r,i){return n.reset(),n.next(t,r,i),n.keep}},A=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return r(t,n),t.prototype.init=function(){this.i=b(this.params,this.options.compare)},t.prototype.reset=function(){n.prototype.reset.call(this),this.keep=!0},t.prototype.next=function(n){this.i(n)&&(this.done=!0,this.keep=!1)},t}(l),k=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return r(t,n),t.prototype.init=function(){this.u=_(this.params,this.owneryQuery,this.options)},t.prototype.reset=function(){n.prototype.reset.call(this),this.u.reset()},t.prototype.next=function(n){if(o(n)){for(var t=0,r=n.length;t<r;t++)this.u.reset(),this.u.next(n[t],t,n),this.keep=this.keep||this.u.keep;this.done=!0}else this.done=!1,this.keep=!1},t}(l),z=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return r(t,n),t.prototype.init=function(){this.u=_(this.params,this.owneryQuery,this.options)},t.prototype.reset=function(){this.u.reset()},t.prototype.next=function(n,t,r){this.u.next(n,t,r),this.done=this.u.done,this.keep=!this.u.keep},t}(l),F=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return r(t,n),t.prototype.init=function(){},t.prototype.next=function(n){o(n)&&n.length===this.params&&(this.done=!0,this.keep=!0)},t}(l),N=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return r(t,n),t.prototype.init=function(){var n=this;this.o=this.params.map((function(t){return _(t,null,n.options)}))},t.prototype.reset=function(){this.done=!1,this.keep=!1;for(var n=0,t=this.o.length;n<t;n++)this.o[n].reset()},t.prototype.next=function(n,t,r){for(var i=!1,u=!1,e=0,o=this.o.length;e<o;e++){var f=this.o[e];if(f.next(n,t,r),f.keep){i=!0,u=f.keep;break}}this.keep=u,this.done=i},t}(l),q=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return r(t,n),t.prototype.next=function(t,r,i){n.prototype.next.call(this,t,r,i),this.keep=!this.keep},t}(N),D=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return r(t,n),t.prototype.init=function(){var n=this;this.h=this.params.map((function(t){if(m(t))throw new Error("cannot nest $ under "+n.constructor.name.toLowerCase());return b(t,n.options.compare)}))},t.prototype.next=function(n,t,r){for(var i=!1,u=!1,e=0,o=this.h.length;e<o;e++){if((0,this.h[e])(n)){i=!0,u=!0;break}}this.keep=u,this.done=i},t}(l),M=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return r(t,n),t.prototype.next=function(t,r,i){n.prototype.next.call(this,t,r,i),this.keep=!this.keep},t}(D),P=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return r(t,n),t.prototype.next=function(n,t,r){r.hasOwnProperty(t)===this.params&&(this.done=!0,this.keep=!0)},t}(l),R=function(n){function t(t,r,i,u){return n.call(this,t,r,i,t.map((function(n){return _(n,r,i)})),u)||this}return r(t,n),t.prototype.next=function(n,t,r){this.childrenNext(n,t,r)},t}(w),S=function(n,t,r){return new d(n,t,r)},C=function(n,t,r,i){return new A(n,t,r,i)},I=function(n,t,r,i){return new N(n,t,r,i)},T=function(n,t,r,i){return new q(n,t,r,i)},U=function(n,t,r,i){return new k(n,t,r,i)},B=function(n,t,r,i){return new M(n,t,r,i)},G=function(n,t,r,i){return new D(n,t,r,i)},H=j((function(n){return function(t){return t<n}})),J=j((function(n){return function(t){return t<=n}})),K=j((function(n){return function(t){return t>n}})),L=j((function(n){return function(t){return t>=n}})),Q=function(n,t,r){var i=n[0],u=n[1];return new d((function(n){return e(n)%i===u}),t,r)},V=function(n,t,r,i){return new P(n,t,r,i)},W=function(n,t,r){return new d(new RegExp(n,t.$options),t,r)},X=function(n,t,r,i){return new z(n,t,r,i)},Y={number:function(n){return"number"==typeof n},string:function(n){return"string"==typeof n},bool:function(n){return"boolean"==typeof n},array:function(n){return Array.isArray(n)},null:function(n){return null===n},timestamp:function(n){return n instanceof Date}},Z=function(n,t,r){return new d((function(t){if("string"==typeof n){if(!Y[n])throw new Error("Type alias does not exist");return Y[n](t)}return null!=t&&(t instanceof n||t.constructor===n)}),t,r)},nn=function(n,t,r,i){return new R(n,t,r,i)},tn=nn,rn=function(n,t,r){return new F(n,t,r,"$size")},un=function(){return null},en=function(n,t,r){var i;if(c(n))i=n;else{if(process.env.CSP_ENABLED)throw new Error('In CSP mode, sift does not support strings in "$where" condition');i=new Function("obj","return "+n)}return new d((function(n){return i.bind(n)(n)}),t,r)},on=Object.freeze({__proto__:null,$Size:F,$eq:S,$ne:C,$or:I,$nor:T,$elemMatch:U,$nin:B,$in:G,$lt:H,$lte:J,$gt:K,$gte:L,$mod:Q,$exists:V,$regex:W,$not:X,$type:Z,$and:nn,$all:tn,$size:rn,$options:un,$where:en}),fn=function(n,t,r){var i=void 0===r?{}:r,u=i.compare,e=i.operations;return _(n,t,{compare:u,operations:Object.assign({},on,e||{})})};n.$Size=F,n.$all=tn,n.$and=nn,n.$elemMatch=U,n.$eq=S,n.$exists=V,n.$gt=K,n.$gte=L,n.$in=G,n.$lt=H,n.$lte=J,n.$mod=Q,n.$ne=C,n.$nin=B,n.$nor=T,n.$not=X,n.$options=un,n.$or=I,n.$regex=W,n.$size=rn,n.$type=Z,n.$where=en,n.EqualsOperation=d,n.createDefaultQueryOperation=fn,n.createEqualsOperation=function(n,t,r){return new d(n,t,r)},n.createOperationTester=E,n.createQueryOperation=_,n.createQueryTester=function(n,t){return void 0===t&&(t={}),E(_(n,null,t))},n.default=function(n,t){void 0===t&&(t={});var r=fn(n,null,t);return E(r)},Object.defineProperty(n,"l",{value:!0})})); | ||
//# 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
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
267025
2773