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.
Files changed (214) hide show
  1. package/README.md +34 -12
  2. package/dist/Query.d.ts +45 -0
  3. package/dist/Query.d.ts.map +1 -0
  4. package/dist/Query.js +44 -3
  5. package/dist/Query.js.map +1 -0
  6. package/dist/async/AsyncQuery.d.ts +41 -0
  7. package/dist/async/AsyncQuery.d.ts.map +1 -0
  8. package/dist/async/AsyncQuery.js +181 -0
  9. package/dist/async/AsyncQuery.js.map +1 -0
  10. package/dist/async/operators/allAsync.d.ts +2 -0
  11. package/dist/async/operators/allAsync.d.ts.map +1 -0
  12. package/dist/async/operators/allAsync.js +12 -0
  13. package/dist/async/operators/allAsync.js.map +1 -0
  14. package/dist/async/operators/anyAsync.d.ts +2 -0
  15. package/dist/async/operators/anyAsync.d.ts.map +1 -0
  16. package/dist/async/operators/anyAsync.js +18 -0
  17. package/dist/async/operators/anyAsync.js.map +1 -0
  18. package/dist/async/operators/appendAsync.d.ts +2 -0
  19. package/dist/async/operators/appendAsync.d.ts.map +1 -0
  20. package/dist/async/operators/appendAsync.js +8 -0
  21. package/dist/async/operators/appendAsync.js.map +1 -0
  22. package/dist/async/operators/concatAsync.d.ts +2 -0
  23. package/dist/async/operators/concatAsync.d.ts.map +1 -0
  24. package/dist/async/operators/concatAsync.js +8 -0
  25. package/dist/async/operators/concatAsync.js.map +1 -0
  26. package/dist/async/operators/countAsync.d.ts +2 -0
  27. package/dist/async/operators/countAsync.d.ts.map +1 -0
  28. package/dist/async/operators/countAsync.js +13 -0
  29. package/dist/async/operators/countAsync.js.map +1 -0
  30. package/dist/async/operators/distinctAsync.d.ts +2 -0
  31. package/dist/async/operators/distinctAsync.d.ts.map +1 -0
  32. package/dist/async/operators/distinctAsync.js +14 -0
  33. package/dist/async/operators/distinctAsync.js.map +1 -0
  34. package/dist/async/operators/exceptAsync.d.ts +2 -0
  35. package/dist/async/operators/exceptAsync.d.ts.map +1 -0
  36. package/dist/async/operators/exceptAsync.js +18 -0
  37. package/dist/async/operators/exceptAsync.js.map +1 -0
  38. package/dist/async/operators/firstAsync.d.ts +2 -0
  39. package/dist/async/operators/firstAsync.d.ts.map +1 -0
  40. package/dist/async/operators/firstAsync.js +21 -0
  41. package/dist/async/operators/firstAsync.js.map +1 -0
  42. package/dist/async/operators/groupByAsync.d.ts +3 -0
  43. package/dist/async/operators/groupByAsync.d.ts.map +1 -0
  44. package/dist/async/operators/groupByAsync.js +22 -0
  45. package/dist/async/operators/groupByAsync.js.map +1 -0
  46. package/dist/async/operators/intersectAsync.d.ts +2 -0
  47. package/dist/async/operators/intersectAsync.d.ts.map +1 -0
  48. package/dist/async/operators/intersectAsync.js +18 -0
  49. package/dist/async/operators/intersectAsync.js.map +1 -0
  50. package/dist/async/operators/joinAsync.d.ts +2 -0
  51. package/dist/async/operators/joinAsync.d.ts.map +1 -0
  52. package/dist/async/operators/joinAsync.js +25 -0
  53. package/dist/async/operators/joinAsync.js.map +1 -0
  54. package/dist/async/operators/maxAsync.d.ts +2 -0
  55. package/dist/async/operators/maxAsync.d.ts.map +1 -0
  56. package/dist/async/operators/maxAsync.js +17 -0
  57. package/dist/async/operators/maxAsync.js.map +1 -0
  58. package/dist/async/operators/minAsync.d.ts +2 -0
  59. package/dist/async/operators/minAsync.d.ts.map +1 -0
  60. package/dist/async/operators/minAsync.js +17 -0
  61. package/dist/async/operators/minAsync.js.map +1 -0
  62. package/dist/async/operators/orderByAsync.d.ts +2 -0
  63. package/dist/async/operators/orderByAsync.d.ts.map +1 -0
  64. package/dist/async/operators/orderByAsync.js +19 -0
  65. package/dist/async/operators/orderByAsync.js.map +1 -0
  66. package/dist/async/operators/orderByManyAsync.d.ts +6 -0
  67. package/dist/async/operators/orderByManyAsync.d.ts.map +1 -0
  68. package/dist/async/operators/orderByManyAsync.js +25 -0
  69. package/dist/async/operators/orderByManyAsync.js.map +1 -0
  70. package/dist/async/operators/prependAsync.d.ts +2 -0
  71. package/dist/async/operators/prependAsync.d.ts.map +1 -0
  72. package/dist/async/operators/prependAsync.js +8 -0
  73. package/dist/async/operators/prependAsync.js.map +1 -0
  74. package/dist/async/operators/selectAsync.d.ts +2 -0
  75. package/dist/async/operators/selectAsync.d.ts.map +1 -0
  76. package/dist/async/operators/selectAsync.js +10 -0
  77. package/dist/async/operators/selectAsync.js.map +1 -0
  78. package/dist/async/operators/selectManyAsync.d.ts +2 -0
  79. package/dist/async/operators/selectManyAsync.d.ts.map +1 -0
  80. package/dist/async/operators/selectManyAsync.js +13 -0
  81. package/dist/async/operators/selectManyAsync.js.map +1 -0
  82. package/dist/async/operators/skipAsync.d.ts +2 -0
  83. package/dist/async/operators/skipAsync.d.ts.map +1 -0
  84. package/dist/async/operators/skipAsync.js +14 -0
  85. package/dist/async/operators/skipAsync.js.map +1 -0
  86. package/dist/async/operators/sumAsync.d.ts +2 -0
  87. package/dist/async/operators/sumAsync.d.ts.map +1 -0
  88. package/dist/async/operators/sumAsync.js +15 -0
  89. package/dist/async/operators/sumAsync.js.map +1 -0
  90. package/dist/async/operators/takeAsync.d.ts +2 -0
  91. package/dist/async/operators/takeAsync.d.ts.map +1 -0
  92. package/dist/async/operators/takeAsync.js +13 -0
  93. package/dist/async/operators/takeAsync.js.map +1 -0
  94. package/dist/async/operators/toArrayAsync.d.ts +2 -0
  95. package/dist/async/operators/toArrayAsync.d.ts.map +1 -0
  96. package/dist/async/operators/toArrayAsync.js +11 -0
  97. package/dist/async/operators/toArrayAsync.js.map +1 -0
  98. package/dist/async/operators/unionAsync.d.ts +2 -0
  99. package/dist/async/operators/unionAsync.d.ts.map +1 -0
  100. package/dist/async/operators/unionAsync.js +21 -0
  101. package/dist/async/operators/unionAsync.js.map +1 -0
  102. package/dist/async/operators/whereAsync.d.ts +2 -0
  103. package/dist/async/operators/whereAsync.d.ts.map +1 -0
  104. package/dist/async/operators/whereAsync.js +12 -0
  105. package/dist/async/operators/whereAsync.js.map +1 -0
  106. package/dist/json/fromJson.d.ts +20 -0
  107. package/dist/json/fromJson.d.ts.map +1 -0
  108. package/dist/json/fromJson.js +49 -0
  109. package/dist/json/fromJson.js.map +1 -0
  110. package/dist/operators/all.d.ts +2 -0
  111. package/dist/operators/all.d.ts.map +1 -0
  112. package/dist/operators/all.js +12 -0
  113. package/dist/operators/all.js.map +1 -0
  114. package/dist/operators/any.d.ts +2 -0
  115. package/dist/operators/any.d.ts.map +1 -0
  116. package/dist/operators/any.js +17 -0
  117. package/dist/operators/any.js.map +1 -0
  118. package/dist/operators/append.d.ts +2 -0
  119. package/dist/operators/append.d.ts.map +1 -0
  120. package/dist/operators/append.js +8 -0
  121. package/dist/operators/append.js.map +1 -0
  122. package/dist/operators/concat.d.ts +2 -0
  123. package/dist/operators/concat.d.ts.map +1 -0
  124. package/dist/operators/concat.js +8 -0
  125. package/dist/operators/concat.js.map +1 -0
  126. package/dist/operators/count.d.ts +2 -0
  127. package/dist/operators/count.d.ts.map +1 -0
  128. package/dist/operators/count.js +13 -0
  129. package/dist/operators/count.js.map +1 -0
  130. package/dist/operators/distinct.d.ts +2 -0
  131. package/dist/operators/distinct.d.ts.map +1 -0
  132. package/dist/operators/distinct.js +14 -0
  133. package/dist/operators/distinct.js.map +1 -0
  134. package/dist/operators/except.d.ts +2 -0
  135. package/dist/operators/except.d.ts.map +1 -0
  136. package/dist/operators/except.js +18 -0
  137. package/dist/operators/except.js.map +1 -0
  138. package/dist/operators/first.d.ts +2 -0
  139. package/dist/operators/first.d.ts.map +1 -0
  140. package/dist/operators/first.js +21 -0
  141. package/dist/operators/first.js.map +1 -0
  142. package/dist/operators/groupBy.d.ts +8 -0
  143. package/dist/operators/groupBy.d.ts.map +1 -0
  144. package/dist/operators/groupBy.js +31 -0
  145. package/dist/operators/groupBy.js.map +1 -0
  146. package/dist/operators/intersect.d.ts +2 -0
  147. package/dist/operators/intersect.d.ts.map +1 -0
  148. package/dist/operators/intersect.js +18 -0
  149. package/dist/operators/intersect.js.map +1 -0
  150. package/dist/operators/join.d.ts +2 -0
  151. package/dist/operators/join.d.ts.map +1 -0
  152. package/dist/operators/join.js +25 -0
  153. package/dist/operators/join.js.map +1 -0
  154. package/dist/operators/max.d.ts +2 -0
  155. package/dist/operators/max.d.ts.map +1 -0
  156. package/dist/operators/max.js +17 -0
  157. package/dist/operators/max.js.map +1 -0
  158. package/dist/operators/min.d.ts +2 -0
  159. package/dist/operators/min.d.ts.map +1 -0
  160. package/dist/operators/min.js +17 -0
  161. package/dist/operators/min.js.map +1 -0
  162. package/dist/operators/orderBy.d.ts +2 -0
  163. package/dist/operators/orderBy.d.ts.map +1 -0
  164. package/dist/operators/orderBy.js +15 -0
  165. package/dist/operators/orderBy.js.map +1 -0
  166. package/dist/operators/orderByMany.d.ts +6 -0
  167. package/dist/operators/orderByMany.d.ts.map +1 -0
  168. package/dist/operators/orderByMany.js +18 -0
  169. package/dist/operators/orderByMany.js.map +1 -0
  170. package/dist/operators/prepend.d.ts +2 -0
  171. package/dist/operators/prepend.d.ts.map +1 -0
  172. package/dist/operators/prepend.js +8 -0
  173. package/dist/operators/prepend.js.map +1 -0
  174. package/dist/operators/select.d.ts +2 -0
  175. package/dist/operators/select.d.ts.map +1 -0
  176. package/dist/operators/select.js +10 -0
  177. package/dist/operators/select.js.map +1 -0
  178. package/dist/operators/selectMany.d.ts +2 -0
  179. package/dist/operators/selectMany.d.ts.map +1 -0
  180. package/dist/operators/selectMany.js +12 -0
  181. package/dist/operators/selectMany.js.map +1 -0
  182. package/dist/operators/skip.d.ts +2 -0
  183. package/dist/operators/skip.d.ts.map +1 -0
  184. package/dist/operators/skip.js +14 -0
  185. package/dist/operators/skip.js.map +1 -0
  186. package/dist/operators/sum.d.ts +2 -0
  187. package/dist/operators/sum.d.ts.map +1 -0
  188. package/dist/operators/sum.js +15 -0
  189. package/dist/operators/sum.js.map +1 -0
  190. package/dist/operators/take.d.ts +2 -0
  191. package/dist/operators/take.d.ts.map +1 -0
  192. package/dist/operators/take.js +13 -0
  193. package/dist/operators/take.js.map +1 -0
  194. package/dist/operators/toArray.d.ts +2 -0
  195. package/dist/operators/toArray.d.ts.map +1 -0
  196. package/dist/operators/toArray.js +7 -0
  197. package/dist/operators/toArray.js.map +1 -0
  198. package/dist/operators/union.d.ts +2 -0
  199. package/dist/operators/union.d.ts.map +1 -0
  200. package/dist/operators/union.js +21 -0
  201. package/dist/operators/union.js.map +1 -0
  202. package/dist/operators/where.d.ts +2 -0
  203. package/dist/operators/where.d.ts.map +1 -0
  204. package/dist/operators/where.js +12 -0
  205. package/dist/operators/where.js.map +1 -0
  206. package/dist/utils/comparers.d.ts +3 -0
  207. package/dist/utils/comparers.d.ts.map +1 -0
  208. package/dist/utils/comparers.js +21 -0
  209. package/dist/utils/comparers.js.map +1 -0
  210. package/dist/utils/guards.d.ts +10 -0
  211. package/dist/utils/guards.d.ts.map +1 -0
  212. package/dist/utils/guards.js +49 -0
  213. package/dist/utils/guards.js.map +1 -0
  214. 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,2 @@
1
+ export declare function skip<T>(source: Iterable<T>, count: number): Iterable<T>;
2
+ //# sourceMappingURL=skip.d.ts.map
@@ -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,2 @@
1
+ export declare function sum<T>(source: Iterable<T>, selector: (item: T) => number): number;
2
+ //# sourceMappingURL=sum.d.ts.map
@@ -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,2 @@
1
+ export declare function take<T>(source: Iterable<T>, count: number): Iterable<T>;
2
+ //# sourceMappingURL=take.d.ts.map
@@ -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,2 @@
1
+ export declare function toArray<T>(source: Iterable<T>): T[];
2
+ //# sourceMappingURL=toArray.d.ts.map
@@ -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,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toArray = toArray;
4
+ function toArray(source) {
5
+ return Array.from(source);
6
+ }
7
+ //# sourceMappingURL=toArray.js.map
@@ -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,2 @@
1
+ export declare function union<T, TKey = T>(source: Iterable<T>, other: Iterable<T>, keySelector?: (item: T) => TKey): Iterable<T>;
2
+ //# sourceMappingURL=union.d.ts.map
@@ -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,2 @@
1
+ export declare function where<T>(source: Iterable<T>, predicate: (item: T, index: number) => boolean): Iterable<T>;
2
+ //# sourceMappingURL=where.d.ts.map
@@ -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,3 @@
1
+ export declare function defaultComparer<T>(a: T, b: T): number;
2
+ export declare function identity<T>(item: T): T;
3
+ //# sourceMappingURL=comparers.d.ts.map
@@ -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": "1.0.1",
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/src/**/*",
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
+ }