inqjs 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -12
- package/dist/Query.d.ts +45 -0
- package/dist/Query.d.ts.map +1 -0
- package/dist/Query.js +44 -3
- package/dist/Query.js.map +1 -0
- package/dist/async/AsyncQuery.d.ts +41 -0
- package/dist/async/AsyncQuery.d.ts.map +1 -0
- package/dist/async/AsyncQuery.js +181 -0
- package/dist/async/AsyncQuery.js.map +1 -0
- package/dist/async/operators/allAsync.d.ts +2 -0
- package/dist/async/operators/allAsync.d.ts.map +1 -0
- package/dist/async/operators/allAsync.js +12 -0
- package/dist/async/operators/allAsync.js.map +1 -0
- package/dist/async/operators/anyAsync.d.ts +2 -0
- package/dist/async/operators/anyAsync.d.ts.map +1 -0
- package/dist/async/operators/anyAsync.js +18 -0
- package/dist/async/operators/anyAsync.js.map +1 -0
- package/dist/async/operators/appendAsync.d.ts +2 -0
- package/dist/async/operators/appendAsync.d.ts.map +1 -0
- package/dist/async/operators/appendAsync.js +8 -0
- package/dist/async/operators/appendAsync.js.map +1 -0
- package/dist/async/operators/concatAsync.d.ts +2 -0
- package/dist/async/operators/concatAsync.d.ts.map +1 -0
- package/dist/async/operators/concatAsync.js +8 -0
- package/dist/async/operators/concatAsync.js.map +1 -0
- package/dist/async/operators/countAsync.d.ts +2 -0
- package/dist/async/operators/countAsync.d.ts.map +1 -0
- package/dist/async/operators/countAsync.js +13 -0
- package/dist/async/operators/countAsync.js.map +1 -0
- package/dist/async/operators/distinctAsync.d.ts +2 -0
- package/dist/async/operators/distinctAsync.d.ts.map +1 -0
- package/dist/async/operators/distinctAsync.js +14 -0
- package/dist/async/operators/distinctAsync.js.map +1 -0
- package/dist/async/operators/exceptAsync.d.ts +2 -0
- package/dist/async/operators/exceptAsync.d.ts.map +1 -0
- package/dist/async/operators/exceptAsync.js +18 -0
- package/dist/async/operators/exceptAsync.js.map +1 -0
- package/dist/async/operators/firstAsync.d.ts +2 -0
- package/dist/async/operators/firstAsync.d.ts.map +1 -0
- package/dist/async/operators/firstAsync.js +21 -0
- package/dist/async/operators/firstAsync.js.map +1 -0
- package/dist/async/operators/groupByAsync.d.ts +3 -0
- package/dist/async/operators/groupByAsync.d.ts.map +1 -0
- package/dist/async/operators/groupByAsync.js +22 -0
- package/dist/async/operators/groupByAsync.js.map +1 -0
- package/dist/async/operators/intersectAsync.d.ts +2 -0
- package/dist/async/operators/intersectAsync.d.ts.map +1 -0
- package/dist/async/operators/intersectAsync.js +18 -0
- package/dist/async/operators/intersectAsync.js.map +1 -0
- package/dist/async/operators/joinAsync.d.ts +2 -0
- package/dist/async/operators/joinAsync.d.ts.map +1 -0
- package/dist/async/operators/joinAsync.js +25 -0
- package/dist/async/operators/joinAsync.js.map +1 -0
- package/dist/async/operators/maxAsync.d.ts +2 -0
- package/dist/async/operators/maxAsync.d.ts.map +1 -0
- package/dist/async/operators/maxAsync.js +17 -0
- package/dist/async/operators/maxAsync.js.map +1 -0
- package/dist/async/operators/minAsync.d.ts +2 -0
- package/dist/async/operators/minAsync.d.ts.map +1 -0
- package/dist/async/operators/minAsync.js +17 -0
- package/dist/async/operators/minAsync.js.map +1 -0
- package/dist/async/operators/orderByAsync.d.ts +2 -0
- package/dist/async/operators/orderByAsync.d.ts.map +1 -0
- package/dist/async/operators/orderByAsync.js +19 -0
- package/dist/async/operators/orderByAsync.js.map +1 -0
- package/dist/async/operators/orderByManyAsync.d.ts +6 -0
- package/dist/async/operators/orderByManyAsync.d.ts.map +1 -0
- package/dist/async/operators/orderByManyAsync.js +25 -0
- package/dist/async/operators/orderByManyAsync.js.map +1 -0
- package/dist/async/operators/prependAsync.d.ts +2 -0
- package/dist/async/operators/prependAsync.d.ts.map +1 -0
- package/dist/async/operators/prependAsync.js +8 -0
- package/dist/async/operators/prependAsync.js.map +1 -0
- package/dist/async/operators/selectAsync.d.ts +2 -0
- package/dist/async/operators/selectAsync.d.ts.map +1 -0
- package/dist/async/operators/selectAsync.js +10 -0
- package/dist/async/operators/selectAsync.js.map +1 -0
- package/dist/async/operators/selectManyAsync.d.ts +2 -0
- package/dist/async/operators/selectManyAsync.d.ts.map +1 -0
- package/dist/async/operators/selectManyAsync.js +13 -0
- package/dist/async/operators/selectManyAsync.js.map +1 -0
- package/dist/async/operators/skipAsync.d.ts +2 -0
- package/dist/async/operators/skipAsync.d.ts.map +1 -0
- package/dist/async/operators/skipAsync.js +14 -0
- package/dist/async/operators/skipAsync.js.map +1 -0
- package/dist/async/operators/sumAsync.d.ts +2 -0
- package/dist/async/operators/sumAsync.d.ts.map +1 -0
- package/dist/async/operators/sumAsync.js +15 -0
- package/dist/async/operators/sumAsync.js.map +1 -0
- package/dist/async/operators/takeAsync.d.ts +2 -0
- package/dist/async/operators/takeAsync.d.ts.map +1 -0
- package/dist/async/operators/takeAsync.js +13 -0
- package/dist/async/operators/takeAsync.js.map +1 -0
- package/dist/async/operators/toArrayAsync.d.ts +2 -0
- package/dist/async/operators/toArrayAsync.d.ts.map +1 -0
- package/dist/async/operators/toArrayAsync.js +11 -0
- package/dist/async/operators/toArrayAsync.js.map +1 -0
- package/dist/async/operators/unionAsync.d.ts +2 -0
- package/dist/async/operators/unionAsync.d.ts.map +1 -0
- package/dist/async/operators/unionAsync.js +21 -0
- package/dist/async/operators/unionAsync.js.map +1 -0
- package/dist/async/operators/whereAsync.d.ts +2 -0
- package/dist/async/operators/whereAsync.d.ts.map +1 -0
- package/dist/async/operators/whereAsync.js +12 -0
- package/dist/async/operators/whereAsync.js.map +1 -0
- package/dist/json/fromJson.d.ts +20 -0
- package/dist/json/fromJson.d.ts.map +1 -0
- package/dist/json/fromJson.js +49 -0
- package/dist/json/fromJson.js.map +1 -0
- package/dist/operators/all.d.ts +2 -0
- package/dist/operators/all.d.ts.map +1 -0
- package/dist/operators/all.js +12 -0
- package/dist/operators/all.js.map +1 -0
- package/dist/operators/any.d.ts +2 -0
- package/dist/operators/any.d.ts.map +1 -0
- package/dist/operators/any.js +17 -0
- package/dist/operators/any.js.map +1 -0
- package/dist/operators/append.d.ts +2 -0
- package/dist/operators/append.d.ts.map +1 -0
- package/dist/operators/append.js +8 -0
- package/dist/operators/append.js.map +1 -0
- package/dist/operators/concat.d.ts +2 -0
- package/dist/operators/concat.d.ts.map +1 -0
- package/dist/operators/concat.js +8 -0
- package/dist/operators/concat.js.map +1 -0
- package/dist/operators/count.d.ts +2 -0
- package/dist/operators/count.d.ts.map +1 -0
- package/dist/operators/count.js +13 -0
- package/dist/operators/count.js.map +1 -0
- package/dist/operators/distinct.d.ts +2 -0
- package/dist/operators/distinct.d.ts.map +1 -0
- package/dist/operators/distinct.js +14 -0
- package/dist/operators/distinct.js.map +1 -0
- package/dist/operators/except.d.ts +2 -0
- package/dist/operators/except.d.ts.map +1 -0
- package/dist/operators/except.js +18 -0
- package/dist/operators/except.js.map +1 -0
- package/dist/operators/first.d.ts +2 -0
- package/dist/operators/first.d.ts.map +1 -0
- package/dist/operators/first.js +21 -0
- package/dist/operators/first.js.map +1 -0
- package/dist/operators/groupBy.d.ts +8 -0
- package/dist/operators/groupBy.d.ts.map +1 -0
- package/dist/operators/groupBy.js +31 -0
- package/dist/operators/groupBy.js.map +1 -0
- package/dist/operators/intersect.d.ts +2 -0
- package/dist/operators/intersect.d.ts.map +1 -0
- package/dist/operators/intersect.js +18 -0
- package/dist/operators/intersect.js.map +1 -0
- package/dist/operators/join.d.ts +2 -0
- package/dist/operators/join.d.ts.map +1 -0
- package/dist/operators/join.js +25 -0
- package/dist/operators/join.js.map +1 -0
- package/dist/operators/max.d.ts +2 -0
- package/dist/operators/max.d.ts.map +1 -0
- package/dist/operators/max.js +17 -0
- package/dist/operators/max.js.map +1 -0
- package/dist/operators/min.d.ts +2 -0
- package/dist/operators/min.d.ts.map +1 -0
- package/dist/operators/min.js +17 -0
- package/dist/operators/min.js.map +1 -0
- package/dist/operators/orderBy.d.ts +2 -0
- package/dist/operators/orderBy.d.ts.map +1 -0
- package/dist/operators/orderBy.js +15 -0
- package/dist/operators/orderBy.js.map +1 -0
- package/dist/operators/orderByMany.d.ts +6 -0
- package/dist/operators/orderByMany.d.ts.map +1 -0
- package/dist/operators/orderByMany.js +18 -0
- package/dist/operators/orderByMany.js.map +1 -0
- package/dist/operators/prepend.d.ts +2 -0
- package/dist/operators/prepend.d.ts.map +1 -0
- package/dist/operators/prepend.js +8 -0
- package/dist/operators/prepend.js.map +1 -0
- package/dist/operators/select.d.ts +2 -0
- package/dist/operators/select.d.ts.map +1 -0
- package/dist/operators/select.js +10 -0
- package/dist/operators/select.js.map +1 -0
- package/dist/operators/selectMany.d.ts +2 -0
- package/dist/operators/selectMany.d.ts.map +1 -0
- package/dist/operators/selectMany.js +12 -0
- package/dist/operators/selectMany.js.map +1 -0
- package/dist/operators/skip.d.ts +2 -0
- package/dist/operators/skip.d.ts.map +1 -0
- package/dist/operators/skip.js +14 -0
- package/dist/operators/skip.js.map +1 -0
- package/dist/operators/sum.d.ts +2 -0
- package/dist/operators/sum.d.ts.map +1 -0
- package/dist/operators/sum.js +15 -0
- package/dist/operators/sum.js.map +1 -0
- package/dist/operators/take.d.ts +2 -0
- package/dist/operators/take.d.ts.map +1 -0
- package/dist/operators/take.js +13 -0
- package/dist/operators/take.js.map +1 -0
- package/dist/operators/toArray.d.ts +2 -0
- package/dist/operators/toArray.d.ts.map +1 -0
- package/dist/operators/toArray.js +7 -0
- package/dist/operators/toArray.js.map +1 -0
- package/dist/operators/union.d.ts +2 -0
- package/dist/operators/union.d.ts.map +1 -0
- package/dist/operators/union.js +21 -0
- package/dist/operators/union.js.map +1 -0
- package/dist/operators/where.d.ts +2 -0
- package/dist/operators/where.d.ts.map +1 -0
- package/dist/operators/where.js +12 -0
- package/dist/operators/where.js.map +1 -0
- package/dist/utils/comparers.d.ts +3 -0
- package/dist/utils/comparers.d.ts.map +1 -0
- package/dist/utils/comparers.js +21 -0
- package/dist/utils/comparers.js.map +1 -0
- package/dist/utils/guards.d.ts +10 -0
- package/dist/utils/guards.d.ts.map +1 -0
- package/dist/utils/guards.js +49 -0
- package/dist/utils/guards.js.map +1 -0
- package/package.json +24 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectMany = selectMany;
|
|
4
|
+
function* selectMany(source, collectionSelector, resultSelector) {
|
|
5
|
+
let index = 0;
|
|
6
|
+
for (const item of source) {
|
|
7
|
+
for (const collectionItem of collectionSelector(item, index++)) {
|
|
8
|
+
yield resultSelector ? resultSelector(item, collectionItem) : collectionItem;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=selectMany.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectMany.js","sourceRoot":"","sources":["../../src/operators/selectMany.ts"],"names":[],"mappings":";;AAAA,gCAWC;AAXD,QAAe,CAAC,CAAC,UAAU,CACvB,MAAmB,EACnB,kBAA2D,EAC3D,cAAkD;IAElD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QACxB,KAAK,MAAM,cAAc,IAAI,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;YAC7D,MAAM,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;QACjF,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skip.d.ts","sourceRoot":"","sources":["../../src/operators/skip.ts"],"names":[],"mappings":"AAAA,wBAAiB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CASxE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.skip = skip;
|
|
4
|
+
function* skip(source, count) {
|
|
5
|
+
let skipped = 0;
|
|
6
|
+
for (const item of source) {
|
|
7
|
+
if (skipped < count) {
|
|
8
|
+
skipped++;
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
yield item;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=skip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skip.js","sourceRoot":"","sources":["../../src/operators/skip.ts"],"names":[],"mappings":";;AAAA,oBASC;AATD,QAAe,CAAC,CAAC,IAAI,CAAI,MAAmB,EAAE,KAAa;IACvD,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QACxB,IAAI,OAAO,GAAG,KAAK,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,SAAS;QACb,CAAC;QACD,MAAM,IAAI,CAAC;IACf,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sum.d.ts","sourceRoot":"","sources":["../../src/operators/sum.ts"],"names":[],"mappings":"AAAA,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAUjF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sum = sum;
|
|
4
|
+
function sum(source, selector) {
|
|
5
|
+
let total = 0;
|
|
6
|
+
for (const item of source) {
|
|
7
|
+
const value = selector(item);
|
|
8
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
9
|
+
throw new TypeError('sum: value must be a finite number.');
|
|
10
|
+
}
|
|
11
|
+
total += value;
|
|
12
|
+
}
|
|
13
|
+
return total;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=sum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sum.js","sourceRoot":"","sources":["../../src/operators/sum.ts"],"names":[],"mappings":";;AAAA,kBAUC;AAVD,SAAgB,GAAG,CAAI,MAAmB,EAAE,QAA6B;IACrE,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,SAAS,CAAC,qCAAqC,CAAC,CAAC;QAC/D,CAAC;QACD,KAAK,IAAI,KAAK,CAAC;IACnB,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"take.d.ts","sourceRoot":"","sources":["../../src/operators/take.ts"],"names":[],"mappings":"AAAA,wBAAiB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAOxE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.take = take;
|
|
4
|
+
function* take(source, count) {
|
|
5
|
+
let taken = 0;
|
|
6
|
+
for (const item of source) {
|
|
7
|
+
if (taken >= count)
|
|
8
|
+
break;
|
|
9
|
+
yield item;
|
|
10
|
+
taken++;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=take.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"take.js","sourceRoot":"","sources":["../../src/operators/take.ts"],"names":[],"mappings":";;AAAA,oBAOC;AAPD,QAAe,CAAC,CAAC,IAAI,CAAI,MAAmB,EAAE,KAAa;IACvD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QACxB,IAAI,KAAK,IAAI,KAAK;YAAE,MAAM;QAC1B,MAAM,IAAI,CAAC;QACX,KAAK,EAAE,CAAC;IACZ,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toArray.d.ts","sourceRoot":"","sources":["../../src/operators/toArray.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAEnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toArray.js","sourceRoot":"","sources":["../../src/operators/toArray.ts"],"names":[],"mappings":";;AAAA,0BAEC;AAFD,SAAgB,OAAO,CAAI,MAAmB;IAC1C,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../src/operators/union.ts"],"names":[],"mappings":"AAAA,wBAAiB,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAC9B,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EACnB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,WAAW,GAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAA2B,GACtD,QAAQ,CAAC,CAAC,CAAC,CAkBb"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.union = union;
|
|
4
|
+
function* union(source, other, keySelector = ((x) => x)) {
|
|
5
|
+
const seen = new Set();
|
|
6
|
+
for (const item of source) {
|
|
7
|
+
const key = keySelector(item);
|
|
8
|
+
if (!seen.has(key)) {
|
|
9
|
+
seen.add(key);
|
|
10
|
+
yield item;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
for (const item of other) {
|
|
14
|
+
const key = keySelector(item);
|
|
15
|
+
if (!seen.has(key)) {
|
|
16
|
+
seen.add(key);
|
|
17
|
+
yield item;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=union.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../src/operators/union.ts"],"names":[],"mappings":";;AAAA,sBAsBC;AAtBD,QAAe,CAAC,CAAC,KAAK,CAClB,MAAmB,EACnB,KAAkB,EAClB,cAAiC,CAAC,CAAC,CAAI,EAAE,EAAE,CAAC,CAAC,CAAQ;IAErD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAQ,CAAC;IAE7B,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QACxB,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACjB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,MAAM,IAAI,CAAC;QACf,CAAC;IACL,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACjB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,MAAM,IAAI,CAAC;QACf,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"where.d.ts","sourceRoot":"","sources":["../../src/operators/where.ts"],"names":[],"mappings":"AAAA,wBAAiB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAO1G"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.where = where;
|
|
4
|
+
function* where(source, predicate) {
|
|
5
|
+
let index = 0;
|
|
6
|
+
for (const item of source) {
|
|
7
|
+
if (predicate(item, index++)) {
|
|
8
|
+
yield item;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=where.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"where.js","sourceRoot":"","sources":["../../src/operators/where.ts"],"names":[],"mappings":";;AAAA,sBAOC;AAPD,QAAe,CAAC,CAAC,KAAK,CAAI,MAAmB,EAAE,SAA8C;IACzF,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QACxB,IAAI,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,CAAC;QACf,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparers.d.ts","sourceRoot":"","sources":["../../src/utils/comparers.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAOrD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAEtC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultComparer = defaultComparer;
|
|
4
|
+
exports.identity = identity;
|
|
5
|
+
function defaultComparer(a, b) {
|
|
6
|
+
if (a === b)
|
|
7
|
+
return 0;
|
|
8
|
+
if (a === null || a === undefined)
|
|
9
|
+
return -1;
|
|
10
|
+
if (b === null || b === undefined)
|
|
11
|
+
return 1;
|
|
12
|
+
if (a < b)
|
|
13
|
+
return -1;
|
|
14
|
+
if (a > b)
|
|
15
|
+
return 1;
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
function identity(item) {
|
|
19
|
+
return item;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=comparers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparers.js","sourceRoot":"","sources":["../../src/utils/comparers.ts"],"names":[],"mappings":";;AAAA,0CAOC;AAED,4BAEC;AAXD,SAAgB,eAAe,CAAI,CAAI,EAAE,CAAI;IACzC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACtB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,CAAC,CAAC,CAAC;IAC7C,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC,CAAC;IACrB,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IACpB,OAAO,CAAC,CAAC;AACb,CAAC;AAED,SAAgB,QAAQ,CAAI,IAAO;IAC/B,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function isIterable<T>(obj: any): obj is Iterable<T>;
|
|
2
|
+
export declare function isAsyncIterable<T>(obj: any): obj is AsyncIterable<T>;
|
|
3
|
+
export declare function isIterableLike<T>(obj: any): obj is Iterable<T> | AsyncIterable<T>;
|
|
4
|
+
export declare function isFunction(obj: any): obj is Function;
|
|
5
|
+
export declare function assertIterable<T>(source: any, name?: string): asserts source is Iterable<T>;
|
|
6
|
+
export declare function assertIterableLike<T>(source: any, name?: string): asserts source is Iterable<T> | AsyncIterable<T>;
|
|
7
|
+
export declare function assertFunction(fn: any, name: string): asserts fn is Function;
|
|
8
|
+
export declare function assertInteger(num: any, name: string): asserts num is number;
|
|
9
|
+
export declare function assertNonNegative(num: number, name: string): void;
|
|
10
|
+
//# sourceMappingURL=guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/utils/guards.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,CAE1D;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,aAAa,CAAC,CAAC,CAAC,CAEpE;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAEjF;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,QAAQ,CAEpD;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,MAAiB,GAAG,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,CAIrG;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,MAAiB,GAAG,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAI5H;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,IAAI,QAAQ,CAI5E;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI,MAAM,CAI3E;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAIjE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isIterable = isIterable;
|
|
4
|
+
exports.isAsyncIterable = isAsyncIterable;
|
|
5
|
+
exports.isIterableLike = isIterableLike;
|
|
6
|
+
exports.isFunction = isFunction;
|
|
7
|
+
exports.assertIterable = assertIterable;
|
|
8
|
+
exports.assertIterableLike = assertIterableLike;
|
|
9
|
+
exports.assertFunction = assertFunction;
|
|
10
|
+
exports.assertInteger = assertInteger;
|
|
11
|
+
exports.assertNonNegative = assertNonNegative;
|
|
12
|
+
function isIterable(obj) {
|
|
13
|
+
return obj != null && typeof obj[Symbol.iterator] === 'function';
|
|
14
|
+
}
|
|
15
|
+
function isAsyncIterable(obj) {
|
|
16
|
+
return obj != null && typeof obj[Symbol.asyncIterator] === 'function';
|
|
17
|
+
}
|
|
18
|
+
function isIterableLike(obj) {
|
|
19
|
+
return isIterable(obj) || isAsyncIterable(obj);
|
|
20
|
+
}
|
|
21
|
+
function isFunction(obj) {
|
|
22
|
+
return typeof obj === 'function';
|
|
23
|
+
}
|
|
24
|
+
function assertIterable(source, name = 'source') {
|
|
25
|
+
if (!isIterable(source)) {
|
|
26
|
+
throw new TypeError(`${name} must be an iterable.`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function assertIterableLike(source, name = 'source') {
|
|
30
|
+
if (!isIterableLike(source)) {
|
|
31
|
+
throw new TypeError(`${name} must be an iterable or async iterable.`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function assertFunction(fn, name) {
|
|
35
|
+
if (!isFunction(fn)) {
|
|
36
|
+
throw new TypeError(`${name} must be a function.`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function assertInteger(num, name) {
|
|
40
|
+
if (typeof num !== 'number' || !Number.isFinite(num) || !Number.isInteger(num)) {
|
|
41
|
+
throw new TypeError(`${name} must be a finite integer.`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function assertNonNegative(num, name) {
|
|
45
|
+
if (num < 0) {
|
|
46
|
+
throw new TypeError(`${name} must be non-negative.`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/utils/guards.ts"],"names":[],"mappings":";;AAAA,gCAEC;AAED,0CAEC;AAED,wCAEC;AAED,gCAEC;AAED,wCAIC;AAED,gDAIC;AAED,wCAIC;AAED,sCAIC;AAED,8CAIC;AA5CD,SAAgB,UAAU,CAAI,GAAQ;IAClC,OAAO,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAC;AACrE,CAAC;AAED,SAAgB,eAAe,CAAI,GAAQ;IACvC,OAAO,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,UAAU,CAAC;AAC1E,CAAC;AAED,SAAgB,cAAc,CAAI,GAAQ;IACtC,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC;AAED,SAAgB,UAAU,CAAC,GAAQ;IAC/B,OAAO,OAAO,GAAG,KAAK,UAAU,CAAC;AACrC,CAAC;AAED,SAAgB,cAAc,CAAI,MAAW,EAAE,OAAe,QAAQ;IAClE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,uBAAuB,CAAC,CAAC;IACxD,CAAC;AACL,CAAC;AAED,SAAgB,kBAAkB,CAAI,MAAW,EAAE,OAAe,QAAQ;IACtE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,yCAAyC,CAAC,CAAC;IAC1E,CAAC;AACL,CAAC;AAED,SAAgB,cAAc,CAAC,EAAO,EAAE,IAAY;IAChD,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,sBAAsB,CAAC,CAAC;IACvD,CAAC;AACL,CAAC;AAED,SAAgB,aAAa,CAAC,GAAQ,EAAE,IAAY;IAChD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7E,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,4BAA4B,CAAC,CAAC;IAC7D,CAAC;AACL,CAAC;AAED,SAAgB,iBAAiB,CAAC,GAAW,EAAE,IAAY;IACvD,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QACV,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,wBAAwB,CAAC,CAAC;IACzD,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inqjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A lightweight, dependency-free LINQ engine for TypeScript and JavaScript with comprehensive query capabilities",
|
|
5
5
|
"main": "dist/Query.js",
|
|
6
6
|
"types": "dist/Query.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/Query.d.ts",
|
|
10
|
+
"require": "./dist/Query.js",
|
|
11
|
+
"default": "./dist/Query.js"
|
|
12
|
+
},
|
|
13
|
+
"./async": {
|
|
14
|
+
"types": "./dist/async/AsyncQuery.d.ts",
|
|
15
|
+
"require": "./dist/async/AsyncQuery.js",
|
|
16
|
+
"default": "./dist/async/AsyncQuery.js"
|
|
17
|
+
},
|
|
18
|
+
"./json": {
|
|
19
|
+
"types": "./dist/json/fromJson.d.ts",
|
|
20
|
+
"require": "./dist/json/fromJson.js",
|
|
21
|
+
"default": "./dist/json/fromJson.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
7
25
|
"files": [
|
|
8
|
-
"dist
|
|
26
|
+
"dist/**/*",
|
|
9
27
|
"README.md",
|
|
10
28
|
"LICENSE"
|
|
11
29
|
],
|
|
12
30
|
"scripts": {
|
|
13
31
|
"build": "tsc",
|
|
14
|
-
"test": "vitest run",
|
|
32
|
+
"test": "npm run build && vitest run && node tests/query.test.js",
|
|
33
|
+
"test:unit": "vitest run",
|
|
34
|
+
"test:js": "npm run build && node tests/query.test.js",
|
|
15
35
|
"prepublishOnly": "npm run build && npm test"
|
|
16
36
|
},
|
|
17
37
|
"keywords": [
|
|
@@ -44,4 +64,4 @@
|
|
|
44
64
|
"engines": {
|
|
45
65
|
"node": ">=14.0.0"
|
|
46
66
|
}
|
|
47
|
-
}
|
|
67
|
+
}
|