sift
Advanced tools
Comparing version 13.4.0 to 13.5.0
@@ -96,3 +96,3 @@ const typeChecker = (type) => { | ||
this.done = false; | ||
this.success = false; | ||
this.keep = false; | ||
} | ||
@@ -114,3 +114,3 @@ } | ||
reset() { | ||
this.success = false; | ||
this.keep = false; | ||
this.done = false; | ||
@@ -125,11 +125,11 @@ for (let i = 0, { length } = this.children; i < length; i++) { | ||
let done = true; | ||
let success = true; | ||
let keep = true; | ||
for (let i = 0, { length } = this.children; i < length; i++) { | ||
const childOperation = this.children[i]; | ||
childOperation.next(item, key, owner); | ||
if (!childOperation.success) { | ||
success = false; | ||
if (!childOperation.keep) { | ||
keep = false; | ||
} | ||
if (childOperation.done) { | ||
if (!childOperation.success) { | ||
if (!childOperation.keep) { | ||
break; | ||
@@ -142,5 +142,4 @@ } | ||
} | ||
// console.log("DONE", this.params, done, success); | ||
this.done = done; | ||
this.success = success; | ||
this.keep = keep; | ||
} | ||
@@ -200,3 +199,3 @@ } | ||
this.done = true; | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
@@ -210,3 +209,3 @@ } | ||
this.done = true; | ||
this.success = false; | ||
this.keep = false; | ||
} | ||
@@ -293,3 +292,3 @@ } | ||
operation.next(item, key, owner); | ||
return operation.success; | ||
return operation.keep; | ||
}; | ||
@@ -306,3 +305,3 @@ const createQueryTester = (query, options = {}) => { | ||
super.reset(); | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
@@ -312,3 +311,3 @@ next(item) { | ||
this.done = true; | ||
this.success = false; | ||
this.keep = false; | ||
} | ||
@@ -326,13 +325,17 @@ } | ||
} | ||
next(item, key, owner) { | ||
this._queryOperation.reset(); | ||
if (isArray(owner)) { | ||
this._queryOperation.next(item, key, owner); | ||
this.done = | ||
this.done || this._queryOperation.done || key === owner.length - 1; | ||
this.success = this.success || this._queryOperation.success; | ||
next(item) { | ||
if (isArray(item)) { | ||
for (let i = 0, { length } = item; i < length; i++) { | ||
// reset query operation since item being tested needs to pass _all_ query | ||
// operations for it to be a success | ||
this._queryOperation.reset(); | ||
// check item | ||
this._queryOperation.next(item[i], i, item); | ||
this.keep = this.keep || this._queryOperation.keep; | ||
} | ||
this.done = true; | ||
} | ||
else { | ||
this.done = true; | ||
this.success = false; | ||
this.done = false; | ||
this.keep = false; | ||
} | ||
@@ -351,3 +354,3 @@ } | ||
this.done = this._queryOperation.done; | ||
this.success = !this._queryOperation.success; | ||
this.keep = !this._queryOperation.keep; | ||
} | ||
@@ -357,7 +360,11 @@ } | ||
init() { } | ||
next(item, key, parent) { | ||
if (parent && parent.length === this.params) { | ||
next(item) { | ||
if (isArray(item) && item.length === this.params) { | ||
this.done = true; | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
// if (parent && parent.length === this.params) { | ||
// this.done = true; | ||
// this.keep = true; | ||
// } | ||
} | ||
@@ -371,3 +378,3 @@ } | ||
this.done = false; | ||
this.success = false; | ||
this.keep = false; | ||
for (let i = 0, { length } = this._ops; i < length; i++) { | ||
@@ -383,9 +390,9 @@ this._ops[i].reset(); | ||
op.next(item, key, owner); | ||
if (op.success) { | ||
if (op.keep) { | ||
done = true; | ||
success = op.success; | ||
success = op.keep; | ||
break; | ||
} | ||
} | ||
this.success = success; | ||
this.keep = success; | ||
this.done = done; | ||
@@ -397,3 +404,3 @@ } | ||
super.next(item, key, owner); | ||
this.success = !this.success; | ||
this.keep = !this.keep; | ||
} | ||
@@ -421,3 +428,3 @@ } | ||
} | ||
this.success = success; | ||
this.keep = success; | ||
this.done = done; | ||
@@ -429,3 +436,3 @@ } | ||
super.next(item, key, owner); | ||
this.success = !this.success; | ||
this.keep = !this.keep; | ||
} | ||
@@ -437,3 +444,3 @@ } | ||
this.done = true; | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
@@ -468,9 +475,2 @@ } | ||
const $all = $and; | ||
// export const $size = ( | ||
// params: number, | ||
// ownerQuery: Query<any>, | ||
// options: Options | ||
// ) => new EqualsOperation(b => { | ||
// return b && b.length === params; | ||
// }, ownerQuery, options); | ||
const $size = (params, ownerQuery, options) => new $Size(params, ownerQuery, options, "$size"); | ||
@@ -477,0 +477,0 @@ const $options = () => null; |
@@ -125,3 +125,3 @@ /*! ***************************************************************************** | ||
this.done = false; | ||
this.success = false; | ||
this.keep = false; | ||
}; | ||
@@ -149,3 +149,3 @@ return BaseOperation; | ||
GroupOperation.prototype.reset = function () { | ||
this.success = false; | ||
this.keep = false; | ||
this.done = false; | ||
@@ -160,11 +160,11 @@ for (var i = 0, length_2 = this.children.length; i < length_2; i++) { | ||
var done = true; | ||
var success = true; | ||
var keep = true; | ||
for (var i = 0, length_3 = this.children.length; i < length_3; i++) { | ||
var childOperation = this.children[i]; | ||
childOperation.next(item, key, owner); | ||
if (!childOperation.success) { | ||
success = false; | ||
if (!childOperation.keep) { | ||
keep = false; | ||
} | ||
if (childOperation.done) { | ||
if (!childOperation.success) { | ||
if (!childOperation.keep) { | ||
break; | ||
@@ -177,5 +177,4 @@ } | ||
} | ||
// console.log("DONE", this.params, done, success); | ||
this.done = done; | ||
this.success = success; | ||
this.keep = keep; | ||
}; | ||
@@ -251,3 +250,3 @@ return GroupOperation; | ||
this.done = true; | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
@@ -266,3 +265,3 @@ } | ||
this.done = true; | ||
this.success = false; | ||
this.keep = false; | ||
}; | ||
@@ -354,3 +353,3 @@ return NopeOperation; | ||
operation.next(item, key, owner); | ||
return operation.success; | ||
return operation.keep; | ||
}; }; | ||
@@ -372,3 +371,3 @@ var createQueryTester = function (query, options) { | ||
_super.prototype.reset.call(this); | ||
this.success = true; | ||
this.keep = true; | ||
}; | ||
@@ -378,3 +377,3 @@ $Ne.prototype.next = function (item) { | ||
this.done = true; | ||
this.success = false; | ||
this.keep = false; | ||
} | ||
@@ -397,13 +396,17 @@ }; | ||
}; | ||
$ElemMatch.prototype.next = function (item, key, owner) { | ||
this._queryOperation.reset(); | ||
if (isArray(owner)) { | ||
this._queryOperation.next(item, key, owner); | ||
this.done = | ||
this.done || this._queryOperation.done || key === owner.length - 1; | ||
this.success = this.success || this._queryOperation.success; | ||
$ElemMatch.prototype.next = function (item) { | ||
if (isArray(item)) { | ||
for (var i = 0, length_1 = item.length; i < length_1; i++) { | ||
// reset query operation since item being tested needs to pass _all_ query | ||
// operations for it to be a success | ||
this._queryOperation.reset(); | ||
// check item | ||
this._queryOperation.next(item[i], i, item); | ||
this.keep = this.keep || this._queryOperation.keep; | ||
} | ||
this.done = true; | ||
} | ||
else { | ||
this.done = true; | ||
this.success = false; | ||
this.done = false; | ||
this.keep = false; | ||
} | ||
@@ -427,3 +430,3 @@ }; | ||
this.done = this._queryOperation.done; | ||
this.success = !this._queryOperation.success; | ||
this.keep = !this._queryOperation.keep; | ||
}; | ||
@@ -438,7 +441,11 @@ return $Not; | ||
$Size.prototype.init = function () { }; | ||
$Size.prototype.next = function (item, key, parent) { | ||
if (parent && parent.length === this.params) { | ||
$Size.prototype.next = function (item) { | ||
if (isArray(item) && item.length === this.params) { | ||
this.done = true; | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
// if (parent && parent.length === this.params) { | ||
// this.done = true; | ||
// this.keep = true; | ||
// } | ||
}; | ||
@@ -460,4 +467,4 @@ return $Size; | ||
this.done = false; | ||
this.success = false; | ||
for (var i = 0, length_1 = this._ops.length; i < length_1; i++) { | ||
this.keep = false; | ||
for (var i = 0, length_2 = this._ops.length; i < length_2; i++) { | ||
this._ops[i].reset(); | ||
@@ -469,12 +476,12 @@ } | ||
var success = false; | ||
for (var i = 0, length_2 = this._ops.length; i < length_2; i++) { | ||
for (var i = 0, length_3 = this._ops.length; i < length_3; i++) { | ||
var op = this._ops[i]; | ||
op.next(item, key, owner); | ||
if (op.success) { | ||
if (op.keep) { | ||
done = true; | ||
success = op.success; | ||
success = op.keep; | ||
break; | ||
} | ||
} | ||
this.success = success; | ||
this.keep = success; | ||
this.done = done; | ||
@@ -491,3 +498,3 @@ }; | ||
_super.prototype.next.call(this, item, key, owner); | ||
this.success = !this.success; | ||
this.keep = !this.keep; | ||
}; | ||
@@ -513,3 +520,3 @@ return $Nor; | ||
var success = false; | ||
for (var i = 0, length_3 = this._testers.length; i < length_3; i++) { | ||
for (var i = 0, length_4 = this._testers.length; i < length_4; i++) { | ||
var test = this._testers[i]; | ||
@@ -522,3 +529,3 @@ if (test(item)) { | ||
} | ||
this.success = success; | ||
this.keep = success; | ||
this.done = done; | ||
@@ -535,3 +542,3 @@ }; | ||
_super.prototype.next.call(this, item, key, owner); | ||
this.success = !this.success; | ||
this.keep = !this.keep; | ||
}; | ||
@@ -548,3 +555,3 @@ return $Nin; | ||
this.done = true; | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
@@ -591,9 +598,2 @@ }; | ||
var $all = $and; | ||
// export const $size = ( | ||
// params: number, | ||
// ownerQuery: Query<any>, | ||
// options: Options | ||
// ) => new EqualsOperation(b => { | ||
// return b && b.length === params; | ||
// }, ownerQuery, options); | ||
var $size = function (params, ownerQuery, options) { return new $Size(params, ownerQuery, options, "$size"); }; | ||
@@ -600,0 +600,0 @@ var $options = function () { return null; }; |
import { Key, Comparator } from "./utils"; | ||
export interface Operation<TItem> { | ||
readonly success: boolean; | ||
readonly keep: boolean; | ||
readonly done: boolean; | ||
@@ -50,3 +50,3 @@ reset(): any; | ||
readonly options: Options; | ||
success: boolean; | ||
keep: boolean; | ||
done: boolean; | ||
@@ -64,3 +64,3 @@ constructor(params: TParams, owneryQuery: any, options: Options); | ||
readonly children: Operation<any>[]; | ||
success: boolean; | ||
keep: boolean; | ||
done: boolean; | ||
@@ -67,0 +67,0 @@ constructor(params: any, owneryQuery: any, options: Options, children: Operation<any>[]); |
@@ -131,3 +131,3 @@ (function (global, factory) { | ||
this.done = false; | ||
this.success = false; | ||
this.keep = false; | ||
}; | ||
@@ -155,3 +155,3 @@ return BaseOperation; | ||
GroupOperation.prototype.reset = function () { | ||
this.success = false; | ||
this.keep = false; | ||
this.done = false; | ||
@@ -166,11 +166,11 @@ for (var i = 0, length_2 = this.children.length; i < length_2; i++) { | ||
var done = true; | ||
var success = true; | ||
var keep = true; | ||
for (var i = 0, length_3 = this.children.length; i < length_3; i++) { | ||
var childOperation = this.children[i]; | ||
childOperation.next(item, key, owner); | ||
if (!childOperation.success) { | ||
success = false; | ||
if (!childOperation.keep) { | ||
keep = false; | ||
} | ||
if (childOperation.done) { | ||
if (!childOperation.success) { | ||
if (!childOperation.keep) { | ||
break; | ||
@@ -183,5 +183,4 @@ } | ||
} | ||
// console.log("DONE", this.params, done, success); | ||
this.done = done; | ||
this.success = success; | ||
this.keep = keep; | ||
}; | ||
@@ -257,3 +256,3 @@ return GroupOperation; | ||
this.done = true; | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
@@ -272,3 +271,3 @@ } | ||
this.done = true; | ||
this.success = false; | ||
this.keep = false; | ||
}; | ||
@@ -360,3 +359,3 @@ return NopeOperation; | ||
operation.next(item, key, owner); | ||
return operation.success; | ||
return operation.keep; | ||
}; }; | ||
@@ -378,3 +377,3 @@ var createQueryTester = function (query, options) { | ||
_super.prototype.reset.call(this); | ||
this.success = true; | ||
this.keep = true; | ||
}; | ||
@@ -384,3 +383,3 @@ $Ne.prototype.next = function (item) { | ||
this.done = true; | ||
this.success = false; | ||
this.keep = false; | ||
} | ||
@@ -403,13 +402,17 @@ }; | ||
}; | ||
$ElemMatch.prototype.next = function (item, key, owner) { | ||
this._queryOperation.reset(); | ||
if (isArray(owner)) { | ||
this._queryOperation.next(item, key, owner); | ||
this.done = | ||
this.done || this._queryOperation.done || key === owner.length - 1; | ||
this.success = this.success || this._queryOperation.success; | ||
$ElemMatch.prototype.next = function (item) { | ||
if (isArray(item)) { | ||
for (var i = 0, length_1 = item.length; i < length_1; i++) { | ||
// reset query operation since item being tested needs to pass _all_ query | ||
// operations for it to be a success | ||
this._queryOperation.reset(); | ||
// check item | ||
this._queryOperation.next(item[i], i, item); | ||
this.keep = this.keep || this._queryOperation.keep; | ||
} | ||
this.done = true; | ||
} | ||
else { | ||
this.done = true; | ||
this.success = false; | ||
this.done = false; | ||
this.keep = false; | ||
} | ||
@@ -433,3 +436,3 @@ }; | ||
this.done = this._queryOperation.done; | ||
this.success = !this._queryOperation.success; | ||
this.keep = !this._queryOperation.keep; | ||
}; | ||
@@ -444,7 +447,11 @@ return $Not; | ||
$Size.prototype.init = function () { }; | ||
$Size.prototype.next = function (item, key, parent) { | ||
if (parent && parent.length === this.params) { | ||
$Size.prototype.next = function (item) { | ||
if (isArray(item) && item.length === this.params) { | ||
this.done = true; | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
// if (parent && parent.length === this.params) { | ||
// this.done = true; | ||
// this.keep = true; | ||
// } | ||
}; | ||
@@ -466,4 +473,4 @@ return $Size; | ||
this.done = false; | ||
this.success = false; | ||
for (var i = 0, length_1 = this._ops.length; i < length_1; i++) { | ||
this.keep = false; | ||
for (var i = 0, length_2 = this._ops.length; i < length_2; i++) { | ||
this._ops[i].reset(); | ||
@@ -475,12 +482,12 @@ } | ||
var success = false; | ||
for (var i = 0, length_2 = this._ops.length; i < length_2; i++) { | ||
for (var i = 0, length_3 = this._ops.length; i < length_3; i++) { | ||
var op = this._ops[i]; | ||
op.next(item, key, owner); | ||
if (op.success) { | ||
if (op.keep) { | ||
done = true; | ||
success = op.success; | ||
success = op.keep; | ||
break; | ||
} | ||
} | ||
this.success = success; | ||
this.keep = success; | ||
this.done = done; | ||
@@ -497,3 +504,3 @@ }; | ||
_super.prototype.next.call(this, item, key, owner); | ||
this.success = !this.success; | ||
this.keep = !this.keep; | ||
}; | ||
@@ -519,3 +526,3 @@ return $Nor; | ||
var success = false; | ||
for (var i = 0, length_3 = this._testers.length; i < length_3; i++) { | ||
for (var i = 0, length_4 = this._testers.length; i < length_4; i++) { | ||
var test = this._testers[i]; | ||
@@ -528,3 +535,3 @@ if (test(item)) { | ||
} | ||
this.success = success; | ||
this.keep = success; | ||
this.done = done; | ||
@@ -541,3 +548,3 @@ }; | ||
_super.prototype.next.call(this, item, key, owner); | ||
this.success = !this.success; | ||
this.keep = !this.keep; | ||
}; | ||
@@ -554,3 +561,3 @@ return $Nin; | ||
this.done = true; | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
@@ -597,9 +604,2 @@ }; | ||
var $all = $and; | ||
// export const $size = ( | ||
// params: number, | ||
// ownerQuery: Query<any>, | ||
// options: Options | ||
// ) => new EqualsOperation(b => { | ||
// return b && b.length === params; | ||
// }, ownerQuery, options); | ||
var $size = function (params, ownerQuery, options) { return new $Size(params, ownerQuery, options, "$size"); }; | ||
@@ -606,0 +606,0 @@ var $options = function () { return null; }; |
@@ -13,3 +13,3 @@ import { NamedBaseOperation, EqualsOperation, Options, Operation, Query, NamedGroupOperation } from "./core"; | ||
reset(): void; | ||
next(item: any, key: Key, owner: any[]): void; | ||
next(item: any): void; | ||
} | ||
@@ -24,3 +24,3 @@ declare class $Not extends NamedBaseOperation<Query<any>> { | ||
init(): void; | ||
next(item: any, key: Key, parent: any): void; | ||
next(item: any): void; | ||
} | ||
@@ -27,0 +27,0 @@ declare class $Or extends NamedBaseOperation<any> { |
{ | ||
"name": "sift", | ||
"description": "MongoDB query filtering in JavaScript", | ||
"version": "13.4.0", | ||
"version": "13.5.0", | ||
"repository": "crcn/sift.js", | ||
@@ -6,0 +6,0 @@ "sideEffects": false, |
@@ -131,3 +131,3 @@ (function (global, factory) { | ||
this.done = false; | ||
this.success = false; | ||
this.keep = false; | ||
}; | ||
@@ -155,3 +155,3 @@ return BaseOperation; | ||
GroupOperation.prototype.reset = function () { | ||
this.success = false; | ||
this.keep = false; | ||
this.done = false; | ||
@@ -166,11 +166,11 @@ for (var i = 0, length_2 = this.children.length; i < length_2; i++) { | ||
var done = true; | ||
var success = true; | ||
var keep = true; | ||
for (var i = 0, length_3 = this.children.length; i < length_3; i++) { | ||
var childOperation = this.children[i]; | ||
childOperation.next(item, key, owner); | ||
if (!childOperation.success) { | ||
success = false; | ||
if (!childOperation.keep) { | ||
keep = false; | ||
} | ||
if (childOperation.done) { | ||
if (!childOperation.success) { | ||
if (!childOperation.keep) { | ||
break; | ||
@@ -183,5 +183,4 @@ } | ||
} | ||
// console.log("DONE", this.params, done, success); | ||
this.done = done; | ||
this.success = success; | ||
this.keep = keep; | ||
}; | ||
@@ -257,3 +256,3 @@ return GroupOperation; | ||
this.done = true; | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
@@ -272,3 +271,3 @@ } | ||
this.done = true; | ||
this.success = false; | ||
this.keep = false; | ||
}; | ||
@@ -360,3 +359,3 @@ return NopeOperation; | ||
operation.next(item, key, owner); | ||
return operation.success; | ||
return operation.keep; | ||
}; }; | ||
@@ -378,3 +377,3 @@ var createQueryTester = function (query, options) { | ||
_super.prototype.reset.call(this); | ||
this.success = true; | ||
this.keep = true; | ||
}; | ||
@@ -384,3 +383,3 @@ $Ne.prototype.next = function (item) { | ||
this.done = true; | ||
this.success = false; | ||
this.keep = false; | ||
} | ||
@@ -403,13 +402,17 @@ }; | ||
}; | ||
$ElemMatch.prototype.next = function (item, key, owner) { | ||
this._queryOperation.reset(); | ||
if (isArray(owner)) { | ||
this._queryOperation.next(item, key, owner); | ||
this.done = | ||
this.done || this._queryOperation.done || key === owner.length - 1; | ||
this.success = this.success || this._queryOperation.success; | ||
$ElemMatch.prototype.next = function (item) { | ||
if (isArray(item)) { | ||
for (var i = 0, length_1 = item.length; i < length_1; i++) { | ||
// reset query operation since item being tested needs to pass _all_ query | ||
// operations for it to be a success | ||
this._queryOperation.reset(); | ||
// check item | ||
this._queryOperation.next(item[i], i, item); | ||
this.keep = this.keep || this._queryOperation.keep; | ||
} | ||
this.done = true; | ||
} | ||
else { | ||
this.done = true; | ||
this.success = false; | ||
this.done = false; | ||
this.keep = false; | ||
} | ||
@@ -433,3 +436,3 @@ }; | ||
this.done = this._queryOperation.done; | ||
this.success = !this._queryOperation.success; | ||
this.keep = !this._queryOperation.keep; | ||
}; | ||
@@ -444,7 +447,11 @@ return $Not; | ||
$Size.prototype.init = function () { }; | ||
$Size.prototype.next = function (item, key, parent) { | ||
if (parent && parent.length === this.params) { | ||
$Size.prototype.next = function (item) { | ||
if (isArray(item) && item.length === this.params) { | ||
this.done = true; | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
// if (parent && parent.length === this.params) { | ||
// this.done = true; | ||
// this.keep = true; | ||
// } | ||
}; | ||
@@ -466,4 +473,4 @@ return $Size; | ||
this.done = false; | ||
this.success = false; | ||
for (var i = 0, length_1 = this._ops.length; i < length_1; i++) { | ||
this.keep = false; | ||
for (var i = 0, length_2 = this._ops.length; i < length_2; i++) { | ||
this._ops[i].reset(); | ||
@@ -475,12 +482,12 @@ } | ||
var success = false; | ||
for (var i = 0, length_2 = this._ops.length; i < length_2; i++) { | ||
for (var i = 0, length_3 = this._ops.length; i < length_3; i++) { | ||
var op = this._ops[i]; | ||
op.next(item, key, owner); | ||
if (op.success) { | ||
if (op.keep) { | ||
done = true; | ||
success = op.success; | ||
success = op.keep; | ||
break; | ||
} | ||
} | ||
this.success = success; | ||
this.keep = success; | ||
this.done = done; | ||
@@ -497,3 +504,3 @@ }; | ||
_super.prototype.next.call(this, item, key, owner); | ||
this.success = !this.success; | ||
this.keep = !this.keep; | ||
}; | ||
@@ -519,3 +526,3 @@ return $Nor; | ||
var success = false; | ||
for (var i = 0, length_3 = this._testers.length; i < length_3; i++) { | ||
for (var i = 0, length_4 = this._testers.length; i < length_4; i++) { | ||
var test = this._testers[i]; | ||
@@ -528,3 +535,3 @@ if (test(item)) { | ||
} | ||
this.success = success; | ||
this.keep = success; | ||
this.done = done; | ||
@@ -541,3 +548,3 @@ }; | ||
_super.prototype.next.call(this, item, key, owner); | ||
this.success = !this.success; | ||
this.keep = !this.keep; | ||
}; | ||
@@ -554,3 +561,3 @@ return $Nin; | ||
this.done = true; | ||
this.success = true; | ||
this.keep = true; | ||
} | ||
@@ -597,9 +604,2 @@ }; | ||
var $all = $and; | ||
// export const $size = ( | ||
// params: number, | ||
// ownerQuery: Query<any>, | ||
// options: Options | ||
// ) => new EqualsOperation(b => { | ||
// return b && b.length === params; | ||
// }, ownerQuery, options); | ||
var $size = function (params, ownerQuery, options) { return new $Size(params, ownerQuery, options, "$size"); }; | ||
@@ -606,0 +606,0 @@ var $options = function () { return null; }; |
@@ -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.success=!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.success=!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.success||(u=!1),f.done){if(!f.success)break}else r=!1}this.done=r,this.success=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.success=!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.success=!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.success}},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.success=!0},t.prototype.next=function(n){this.i(n)&&(this.done=!0,this.success=!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,t,i){this.u.reset(),o(i)?(this.u.next(n,t,i),this.done=this.done||this.u.done||t===i.length-1,this.success=this.success||this.u.success):(this.done=!0,this.success=!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.success=!this.u.success},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,t,i){i&&i.length===this.params&&(this.done=!0,this.success=!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.success=!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.success){r=!0,u=f.success;break}}this.success=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.success=!this.success},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.success=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.success=!this.success},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.success=!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,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})})); | ||
//# 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
262805
2707