@cspell/cspell-pipe 7.0.0-alpha.2 → 7.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 (175) hide show
  1. package/package.json +28 -38
  2. package/dist/cjs/helpers/distribute.js +0 -37
  3. package/dist/cjs/helpers/index.js +0 -17
  4. package/dist/cjs/helpers/interleave.js +0 -22
  5. package/dist/cjs/helpers/iteratorToIterable.js +0 -18
  6. package/dist/cjs/helpers/toArray.js +0 -21
  7. package/dist/cjs/helpers/toAsyncIterable.js +0 -19
  8. package/dist/cjs/helpers/util.js +0 -15
  9. package/dist/cjs/index.js +0 -60
  10. package/dist/cjs/internalTypes.js +0 -3
  11. package/dist/cjs/operators/append.js +0 -42
  12. package/dist/cjs/operators/await.js +0 -13
  13. package/dist/cjs/operators/combine.js +0 -24
  14. package/dist/cjs/operators/concatMap.js +0 -25
  15. package/dist/cjs/operators/filter.js +0 -36
  16. package/dist/cjs/operators/first.js +0 -40
  17. package/dist/cjs/operators/flatten.js +0 -25
  18. package/dist/cjs/operators/index.js +0 -60
  19. package/dist/cjs/operators/joinStrings.js +0 -28
  20. package/dist/cjs/operators/last.js +0 -45
  21. package/dist/cjs/operators/map.js +0 -25
  22. package/dist/cjs/operators/reduce.js +0 -54
  23. package/dist/cjs/operators/skip.js +0 -33
  24. package/dist/cjs/operators/take.js +0 -37
  25. package/dist/cjs/operators/tap.js +0 -42
  26. package/dist/cjs/operators/types.js +0 -3
  27. package/dist/cjs/operators/unique.js +0 -59
  28. package/dist/cjs/pipe.js +0 -15
  29. package/dist/cjs/reduce.js +0 -27
  30. package/dist/cjs/sync/index.js +0 -26
  31. package/dist/esm/helpers/distribute.d.mts +0 -13
  32. package/dist/esm/helpers/distribute.d.ts +0 -13
  33. package/dist/esm/helpers/distribute.mjs +0 -32
  34. package/dist/esm/helpers/index.d.mts +0 -7
  35. package/dist/esm/helpers/index.d.ts +0 -7
  36. package/dist/esm/helpers/index.mjs +0 -6
  37. package/dist/esm/helpers/interleave.d.mts +0 -2
  38. package/dist/esm/helpers/interleave.d.ts +0 -2
  39. package/dist/esm/helpers/interleave.mjs +0 -17
  40. package/dist/esm/helpers/iteratorToIterable.d.mts +0 -3
  41. package/dist/esm/helpers/iteratorToIterable.d.ts +0 -3
  42. package/dist/esm/helpers/iteratorToIterable.mjs +0 -12
  43. package/dist/esm/helpers/toArray.d.mts +0 -6
  44. package/dist/esm/helpers/toArray.d.ts +0 -6
  45. package/dist/esm/helpers/toArray.mjs +0 -14
  46. package/dist/esm/helpers/toAsyncIterable.d.mts +0 -11
  47. package/dist/esm/helpers/toAsyncIterable.d.ts +0 -11
  48. package/dist/esm/helpers/toAsyncIterable.mjs +0 -14
  49. package/dist/esm/helpers/util.d.mts +0 -4
  50. package/dist/esm/helpers/util.d.ts +0 -4
  51. package/dist/esm/helpers/util.mjs +0 -9
  52. package/dist/esm/index.d.mts +0 -9
  53. package/dist/esm/index.d.ts +0 -9
  54. package/dist/esm/index.mjs +0 -10
  55. package/dist/esm/internalTypes.d.mts +0 -17
  56. package/dist/esm/internalTypes.d.ts +0 -17
  57. package/dist/esm/internalTypes.mjs +0 -1
  58. package/dist/esm/operators/append.d.mts +0 -15
  59. package/dist/esm/operators/append.d.ts +0 -15
  60. package/dist/esm/operators/append.mjs +0 -35
  61. package/dist/esm/operators/await.d.mts +0 -2
  62. package/dist/esm/operators/await.d.ts +0 -2
  63. package/dist/esm/operators/await.mjs +0 -8
  64. package/dist/esm/operators/combine.d.mts +0 -23
  65. package/dist/esm/operators/combine.d.ts +0 -23
  66. package/dist/esm/operators/combine.mjs +0 -18
  67. package/dist/esm/operators/concatMap.d.mts +0 -4
  68. package/dist/esm/operators/concatMap.d.ts +0 -4
  69. package/dist/esm/operators/concatMap.mjs +0 -18
  70. package/dist/esm/operators/filter.d.mts +0 -10
  71. package/dist/esm/operators/filter.d.ts +0 -10
  72. package/dist/esm/operators/filter.mjs +0 -29
  73. package/dist/esm/operators/first.d.mts +0 -10
  74. package/dist/esm/operators/first.d.ts +0 -10
  75. package/dist/esm/operators/first.mjs +0 -33
  76. package/dist/esm/operators/flatten.d.mts +0 -4
  77. package/dist/esm/operators/flatten.d.ts +0 -4
  78. package/dist/esm/operators/flatten.mjs +0 -18
  79. package/dist/esm/operators/index.d.mts +0 -17
  80. package/dist/esm/operators/index.d.ts +0 -17
  81. package/dist/esm/operators/index.mjs +0 -15
  82. package/dist/esm/operators/joinStrings.d.mts +0 -4
  83. package/dist/esm/operators/joinStrings.d.ts +0 -4
  84. package/dist/esm/operators/joinStrings.mjs +0 -21
  85. package/dist/esm/operators/last.d.mts +0 -10
  86. package/dist/esm/operators/last.d.ts +0 -10
  87. package/dist/esm/operators/last.mjs +0 -38
  88. package/dist/esm/operators/map.d.mts +0 -4
  89. package/dist/esm/operators/map.d.ts +0 -4
  90. package/dist/esm/operators/map.mjs +0 -18
  91. package/dist/esm/operators/reduce.d.mts +0 -7
  92. package/dist/esm/operators/reduce.d.ts +0 -7
  93. package/dist/esm/operators/reduce.mjs +0 -48
  94. package/dist/esm/operators/skip.d.mts +0 -4
  95. package/dist/esm/operators/skip.d.ts +0 -4
  96. package/dist/esm/operators/skip.mjs +0 -26
  97. package/dist/esm/operators/take.d.mts +0 -8
  98. package/dist/esm/operators/take.d.ts +0 -8
  99. package/dist/esm/operators/take.mjs +0 -30
  100. package/dist/esm/operators/tap.d.mts +0 -19
  101. package/dist/esm/operators/tap.d.ts +0 -19
  102. package/dist/esm/operators/tap.mjs +0 -35
  103. package/dist/esm/operators/types.d.mts +0 -4
  104. package/dist/esm/operators/types.d.ts +0 -4
  105. package/dist/esm/operators/types.mjs +0 -1
  106. package/dist/esm/operators/unique.d.mts +0 -4
  107. package/dist/esm/operators/unique.d.ts +0 -4
  108. package/dist/esm/operators/unique.mjs +0 -52
  109. package/dist/esm/pipe.d.mts +0 -20
  110. package/dist/esm/pipe.d.ts +0 -20
  111. package/dist/esm/pipe.mjs +0 -9
  112. package/dist/esm/reduce.d.mts +0 -16
  113. package/dist/esm/reduce.d.ts +0 -16
  114. package/dist/esm/reduce.mjs +0 -20
  115. package/dist/esm/sync/index.d.mts +0 -6
  116. package/dist/esm/sync/index.d.ts +0 -6
  117. package/dist/esm/sync/index.mjs +0 -4
  118. /package/dist/{cjs/helpers → helpers}/distribute.d.ts +0 -0
  119. /package/dist/{esm/helpers → helpers}/distribute.js +0 -0
  120. /package/dist/{cjs/helpers → helpers}/index.d.ts +0 -0
  121. /package/dist/{esm/helpers → helpers}/index.js +0 -0
  122. /package/dist/{cjs/helpers → helpers}/interleave.d.ts +0 -0
  123. /package/dist/{esm/helpers → helpers}/interleave.js +0 -0
  124. /package/dist/{cjs/helpers → helpers}/iteratorToIterable.d.ts +0 -0
  125. /package/dist/{esm/helpers → helpers}/iteratorToIterable.js +0 -0
  126. /package/dist/{cjs/helpers → helpers}/toArray.d.ts +0 -0
  127. /package/dist/{esm/helpers → helpers}/toArray.js +0 -0
  128. /package/dist/{cjs/helpers → helpers}/toAsyncIterable.d.ts +0 -0
  129. /package/dist/{esm/helpers → helpers}/toAsyncIterable.js +0 -0
  130. /package/dist/{cjs/helpers → helpers}/util.d.ts +0 -0
  131. /package/dist/{esm/helpers → helpers}/util.js +0 -0
  132. /package/dist/{cjs/index.d.ts → index.d.ts} +0 -0
  133. /package/dist/{esm/index.js → index.js} +0 -0
  134. /package/dist/{cjs/internalTypes.d.ts → internalTypes.d.ts} +0 -0
  135. /package/dist/{esm/internalTypes.js → internalTypes.js} +0 -0
  136. /package/dist/{cjs/operators → operators}/append.d.ts +0 -0
  137. /package/dist/{esm/operators → operators}/append.js +0 -0
  138. /package/dist/{cjs/operators → operators}/await.d.ts +0 -0
  139. /package/dist/{esm/operators → operators}/await.js +0 -0
  140. /package/dist/{cjs/operators → operators}/combine.d.ts +0 -0
  141. /package/dist/{esm/operators → operators}/combine.js +0 -0
  142. /package/dist/{cjs/operators → operators}/concatMap.d.ts +0 -0
  143. /package/dist/{esm/operators → operators}/concatMap.js +0 -0
  144. /package/dist/{cjs/operators → operators}/filter.d.ts +0 -0
  145. /package/dist/{esm/operators → operators}/filter.js +0 -0
  146. /package/dist/{cjs/operators → operators}/first.d.ts +0 -0
  147. /package/dist/{esm/operators → operators}/first.js +0 -0
  148. /package/dist/{cjs/operators → operators}/flatten.d.ts +0 -0
  149. /package/dist/{esm/operators → operators}/flatten.js +0 -0
  150. /package/dist/{cjs/operators → operators}/index.d.ts +0 -0
  151. /package/dist/{esm/operators → operators}/index.js +0 -0
  152. /package/dist/{cjs/operators → operators}/joinStrings.d.ts +0 -0
  153. /package/dist/{esm/operators → operators}/joinStrings.js +0 -0
  154. /package/dist/{cjs/operators → operators}/last.d.ts +0 -0
  155. /package/dist/{esm/operators → operators}/last.js +0 -0
  156. /package/dist/{cjs/operators → operators}/map.d.ts +0 -0
  157. /package/dist/{esm/operators → operators}/map.js +0 -0
  158. /package/dist/{cjs/operators → operators}/reduce.d.ts +0 -0
  159. /package/dist/{esm/operators → operators}/reduce.js +0 -0
  160. /package/dist/{cjs/operators → operators}/skip.d.ts +0 -0
  161. /package/dist/{esm/operators → operators}/skip.js +0 -0
  162. /package/dist/{cjs/operators → operators}/take.d.ts +0 -0
  163. /package/dist/{esm/operators → operators}/take.js +0 -0
  164. /package/dist/{cjs/operators → operators}/tap.d.ts +0 -0
  165. /package/dist/{esm/operators → operators}/tap.js +0 -0
  166. /package/dist/{cjs/operators → operators}/types.d.ts +0 -0
  167. /package/dist/{esm/operators → operators}/types.js +0 -0
  168. /package/dist/{cjs/operators → operators}/unique.d.ts +0 -0
  169. /package/dist/{esm/operators → operators}/unique.js +0 -0
  170. /package/dist/{cjs/pipe.d.ts → pipe.d.ts} +0 -0
  171. /package/dist/{esm/pipe.js → pipe.js} +0 -0
  172. /package/dist/{cjs/reduce.d.ts → reduce.d.ts} +0 -0
  173. /package/dist/{esm/reduce.js → reduce.js} +0 -0
  174. /package/dist/{cjs/sync → sync}/index.d.ts +0 -0
  175. /package/dist/{esm/sync → sync}/index.js +0 -0
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.opJoinStrings = exports.opJoinStringsSync = exports.opJoinStringsAsync = void 0;
4
- const toArray_js_1 = require("../helpers/toArray.js");
5
- const util_js_1 = require("../helpers/util.js");
6
- function opJoinStringsAsync(joinCharacter = ',') {
7
- async function* fn(iter) {
8
- for await (const v of iter) {
9
- const a = await (0, toArray_js_1.toArray)(v);
10
- yield a.join(joinCharacter);
11
- }
12
- }
13
- return fn;
14
- }
15
- exports.opJoinStringsAsync = opJoinStringsAsync;
16
- function opJoinStringsSync(joinCharacter = ',') {
17
- function* fn(iter) {
18
- for (const v of iter) {
19
- const a = (0, toArray_js_1.toArray)(v);
20
- yield a.join(joinCharacter);
21
- }
22
- }
23
- return fn;
24
- }
25
- exports.opJoinStringsSync = opJoinStringsSync;
26
- const opJoinStrings = (joinCharacter) => (0, util_js_1.toPipeFn)(opJoinStringsSync(joinCharacter), opJoinStringsAsync(joinCharacter));
27
- exports.opJoinStrings = opJoinStrings;
28
- //# sourceMappingURL=joinStrings.js.map
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.opLast = exports.opLastSync = exports.opLastAsync = void 0;
4
- const util_js_1 = require("../helpers/util.js");
5
- const symNotFound = Symbol('LastNotFound');
6
- // prettier-ignore
7
- function opLastAsync(lastFn) {
8
- async function* fn(iter) {
9
- let last = symNotFound;
10
- for await (const v of iter) {
11
- const pass = await lastFn(v);
12
- if (pass) {
13
- last = v;
14
- }
15
- }
16
- if (last !== symNotFound)
17
- yield last;
18
- }
19
- return fn;
20
- }
21
- exports.opLastAsync = opLastAsync;
22
- function opLastSync(lastFn) {
23
- function* fn(iter) {
24
- let last = symNotFound;
25
- for (const v of iter) {
26
- if (lastFn(v)) {
27
- last = v;
28
- }
29
- }
30
- if (last !== symNotFound)
31
- yield last;
32
- }
33
- return fn;
34
- }
35
- exports.opLastSync = opLastSync;
36
- function opLast(fn) {
37
- const asyncFn = opLastAsync(fn);
38
- const syncFn = opLastSync(fn);
39
- function _(i) {
40
- return (0, util_js_1.isAsyncIterable)(i) ? asyncFn(i) : syncFn(i);
41
- }
42
- return _;
43
- }
44
- exports.opLast = opLast;
45
- //# sourceMappingURL=last.js.map
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.opMap = exports.opMapSync = exports.opMapAsync = void 0;
4
- const util_js_1 = require("../helpers/util.js");
5
- function opMapAsync(mapFn) {
6
- async function* fn(iter) {
7
- for await (const v of iter) {
8
- yield mapFn(v);
9
- }
10
- }
11
- return fn;
12
- }
13
- exports.opMapAsync = opMapAsync;
14
- function opMapSync(mapFn) {
15
- function* fn(iter) {
16
- for (const v of iter) {
17
- yield mapFn(v);
18
- }
19
- }
20
- return fn;
21
- }
22
- exports.opMapSync = opMapSync;
23
- const opMap = (fn) => (0, util_js_1.toPipeFn)(opMapSync(fn), opMapAsync(fn));
24
- exports.opMap = opMap;
25
- //# sourceMappingURL=map.js.map
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.opReduceSync = exports.opReduceAsync = void 0;
4
- const index_js_1 = require("../helpers/index.js");
5
- function opReduceAsync(reduceFn, initialValue) {
6
- async function* reduce(head, tail) {
7
- for await (const v of tail) {
8
- head = reduceFn(head, v);
9
- }
10
- yield head;
11
- }
12
- async function* fn(iter) {
13
- const ht = initialValue === undefined ? await headTailAsync(iter) : { head: await initialValue, tail: iter };
14
- if (!ht)
15
- return;
16
- yield* reduce(ht.head, ht.tail);
17
- }
18
- return fn;
19
- }
20
- exports.opReduceAsync = opReduceAsync;
21
- function opReduceSync(reduceFn, initialValue) {
22
- function* reduce(head, tail) {
23
- for (const v of tail) {
24
- head = reduceFn(head, v);
25
- }
26
- yield head;
27
- }
28
- function* fn(iter) {
29
- const ht = initialValue === undefined ? headTail(iter) : { head: initialValue, tail: iter };
30
- if (!ht)
31
- return;
32
- yield* reduce(ht.head, ht.tail);
33
- }
34
- return fn;
35
- }
36
- exports.opReduceSync = opReduceSync;
37
- function headTail(iter) {
38
- const iterator = iter[Symbol.iterator]();
39
- const first = iterator.next();
40
- if (first.done)
41
- return undefined;
42
- return { head: first.value, tail: (0, index_js_1.iteratorToIterable)(iterator) };
43
- }
44
- async function headTailAsync(iter) {
45
- const iterator = isIterable(iter) ? iter[Symbol.iterator]() : iter[Symbol.asyncIterator]();
46
- const first = await iterator.next();
47
- if (first.done)
48
- return undefined;
49
- return { head: first.value, tail: (0, index_js_1.asyncIteratorToAsyncIterable)(iterator) };
50
- }
51
- function isIterable(i) {
52
- return typeof i[Symbol.iterator] === 'function';
53
- }
54
- //# sourceMappingURL=reduce.js.map
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.opSkip = exports.opSkipSync = exports.opSkipAsync = void 0;
4
- const util_js_1 = require("../helpers/util.js");
5
- function opSkipAsync(count) {
6
- async function* fn(iter) {
7
- for await (const v of iter) {
8
- if (count > 0) {
9
- --count;
10
- continue;
11
- }
12
- yield v;
13
- }
14
- }
15
- return fn;
16
- }
17
- exports.opSkipAsync = opSkipAsync;
18
- function opSkipSync(count) {
19
- function* fn(iter) {
20
- for (const v of iter) {
21
- if (count > 0) {
22
- --count;
23
- continue;
24
- }
25
- yield v;
26
- }
27
- }
28
- return fn;
29
- }
30
- exports.opSkipSync = opSkipSync;
31
- const opSkip = (count) => (0, util_js_1.toPipeFn)(opSkipSync(count), opSkipAsync(count));
32
- exports.opSkip = opSkip;
33
- //# sourceMappingURL=skip.js.map
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.opTake = exports.opTakeSync = exports.opTakeAsync = void 0;
4
- const util_js_1 = require("../helpers/util.js");
5
- function opTakeAsync(count) {
6
- async function* fn(iter) {
7
- if (count <= 0)
8
- return;
9
- for await (const v of iter) {
10
- yield v;
11
- if (--count <= 0)
12
- return;
13
- }
14
- }
15
- return fn;
16
- }
17
- exports.opTakeAsync = opTakeAsync;
18
- function opTakeSync(count) {
19
- function* fn(iter) {
20
- if (count <= 0)
21
- return;
22
- for (const v of iter) {
23
- yield v;
24
- if (--count <= 0)
25
- return;
26
- }
27
- }
28
- return fn;
29
- }
30
- exports.opTakeSync = opTakeSync;
31
- /**
32
- * Consume only the first `count` number from the iterable.
33
- * @param count - number to take
34
- */
35
- const opTake = (count) => (0, util_js_1.toPipeFn)(opTakeSync(count), opTakeAsync(count));
36
- exports.opTake = opTake;
37
- //# sourceMappingURL=take.js.map
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.opTap = exports.opTapSync = exports.opTapAsync = void 0;
4
- const util_js_1 = require("../helpers/util.js");
5
- /**
6
- * Tap allows you to listen on values, without modifying them.
7
- *
8
- * @param fn - function to call for each value.
9
- */
10
- function opTapAsync(tapFn) {
11
- async function* fn(iter) {
12
- for await (const v of iter) {
13
- tapFn(v);
14
- yield v;
15
- }
16
- }
17
- return fn;
18
- }
19
- exports.opTapAsync = opTapAsync;
20
- /**
21
- * Tap allows you to listen on values, without modifying them.
22
- *
23
- * @param fn - function to call for each value.
24
- */
25
- function opTapSync(tapFn) {
26
- function* fn(iter) {
27
- for (const v of iter) {
28
- tapFn(v);
29
- yield v;
30
- }
31
- }
32
- return fn;
33
- }
34
- exports.opTapSync = opTapSync;
35
- /**
36
- * Tap allows you to listen on values, without modifying them.
37
- *
38
- * @param fn - function to call for each value.
39
- */
40
- const opTap = (fn) => (0, util_js_1.toPipeFn)(opTapSync(fn), opTapAsync(fn));
41
- exports.opTap = opTap;
42
- //# sourceMappingURL=tap.js.map
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.opUnique = exports.opUniqueSync = exports.opUniqueAsync = void 0;
4
- const util_js_1 = require("../helpers/util.js");
5
- function opUniqueAsync(k) {
6
- function fnK(k) {
7
- async function* fn(iter) {
8
- const s = new Set();
9
- for await (const v of iter) {
10
- const kk = k(v);
11
- if (s.has(kk))
12
- continue;
13
- s.add(kk);
14
- yield v;
15
- }
16
- }
17
- return fn;
18
- }
19
- async function* fn(iter) {
20
- const s = new Set();
21
- for await (const v of iter) {
22
- if (s.has(v))
23
- continue;
24
- s.add(v);
25
- yield v;
26
- }
27
- }
28
- return k ? fnK(k) : fn;
29
- }
30
- exports.opUniqueAsync = opUniqueAsync;
31
- function opUniqueSync(k) {
32
- function fnK(key) {
33
- function* fn(iter) {
34
- const s = new Set();
35
- for (const v of iter) {
36
- const kk = key(v);
37
- if (s.has(kk))
38
- continue;
39
- s.add(kk);
40
- yield v;
41
- }
42
- }
43
- return fn;
44
- }
45
- function* fn(iter) {
46
- const s = new Set();
47
- for (const v of iter) {
48
- if (s.has(v))
49
- continue;
50
- s.add(v);
51
- yield v;
52
- }
53
- }
54
- return k ? fnK(k) : fn;
55
- }
56
- exports.opUniqueSync = opUniqueSync;
57
- const opUnique = (getKey) => (0, util_js_1.toPipeFn)(opUniqueSync(getKey), opUniqueAsync(getKey));
58
- exports.opUnique = opUnique;
59
- //# sourceMappingURL=unique.js.map
package/dist/cjs/pipe.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pipeSync = exports.pipeAsync = void 0;
4
- const index_js_1 = require("./helpers/index.js");
5
- const index_js_2 = require("./operators/index.js");
6
- function pipeAsync(i, ...fns) {
7
- const iter = (0, index_js_1.toAsyncIterable)(i);
8
- return (0, index_js_2.opCombineAsync)(...fns)(iter);
9
- }
10
- exports.pipeAsync = pipeAsync;
11
- function pipeSync(i, ...fns) {
12
- return (0, index_js_2.opCombineSync)(...fns)(i);
13
- }
14
- exports.pipeSync = pipeSync;
15
- //# sourceMappingURL=pipe.js.map
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reduce = exports.reduceAsync = exports.reduceSync = void 0;
4
- const index_js_1 = require("./helpers/index.js");
5
- const toArray_js_1 = require("./helpers/toArray.js");
6
- const index_js_2 = require("./operators/index.js");
7
- const pipe_js_1 = require("./pipe.js");
8
- function reduceSync(iter, reduceFn, initialValue) {
9
- const i = initialValue === undefined
10
- ? (0, pipe_js_1.pipeSync)(iter, (0, index_js_2.opReduceSync)(reduceFn))
11
- : (0, pipe_js_1.pipeSync)(iter, (0, index_js_2.opReduceSync)(reduceFn, initialValue));
12
- return [...i][0];
13
- }
14
- exports.reduceSync = reduceSync;
15
- async function reduceAsync(iter, reduceFn, initialValue) {
16
- const i = initialValue === undefined
17
- ? (0, pipe_js_1.pipeAsync)(iter, (0, index_js_2.opReduceAsync)(reduceFn))
18
- : (0, pipe_js_1.pipeAsync)(iter, (0, index_js_2.opReduceAsync)(reduceFn, initialValue));
19
- const arr = await (0, toArray_js_1.toArrayAsync)(i);
20
- return arr[0];
21
- }
22
- exports.reduceAsync = reduceAsync;
23
- function reduce(iter, reduceFn, initialValue) {
24
- return (0, index_js_1.isAsyncIterable)(iter) ? reduceAsync(iter, reduceFn, initialValue) : reduceSync(iter, reduceFn, initialValue);
25
- }
26
- exports.reduce = reduce;
27
- //# sourceMappingURL=reduce.js.map
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reduce = exports.pipeSync = exports.pipe = exports.opUnique = exports.opTap = exports.opTake = exports.opSkip = exports.opReduce = exports.opMap = exports.opLast = exports.opJoinStrings = exports.opFlatten = exports.opFirst = exports.opFilter = exports.opConcatMap = exports.opCombine = exports.opAppend = exports.toArray = void 0;
4
- var toArray_js_1 = require("../helpers/toArray.js");
5
- Object.defineProperty(exports, "toArray", { enumerable: true, get: function () { return toArray_js_1.toArraySync; } });
6
- var index_js_1 = require("../operators/index.js");
7
- Object.defineProperty(exports, "opAppend", { enumerable: true, get: function () { return index_js_1.opAppendSync; } });
8
- Object.defineProperty(exports, "opCombine", { enumerable: true, get: function () { return index_js_1.opCombineSync; } });
9
- Object.defineProperty(exports, "opConcatMap", { enumerable: true, get: function () { return index_js_1.opConcatMapSync; } });
10
- Object.defineProperty(exports, "opFilter", { enumerable: true, get: function () { return index_js_1.opFilterSync; } });
11
- Object.defineProperty(exports, "opFirst", { enumerable: true, get: function () { return index_js_1.opFirstSync; } });
12
- Object.defineProperty(exports, "opFlatten", { enumerable: true, get: function () { return index_js_1.opFlattenSync; } });
13
- Object.defineProperty(exports, "opJoinStrings", { enumerable: true, get: function () { return index_js_1.opJoinStringsSync; } });
14
- Object.defineProperty(exports, "opLast", { enumerable: true, get: function () { return index_js_1.opLastSync; } });
15
- Object.defineProperty(exports, "opMap", { enumerable: true, get: function () { return index_js_1.opMapSync; } });
16
- Object.defineProperty(exports, "opReduce", { enumerable: true, get: function () { return index_js_1.opReduceSync; } });
17
- Object.defineProperty(exports, "opSkip", { enumerable: true, get: function () { return index_js_1.opSkipSync; } });
18
- Object.defineProperty(exports, "opTake", { enumerable: true, get: function () { return index_js_1.opTakeSync; } });
19
- Object.defineProperty(exports, "opTap", { enumerable: true, get: function () { return index_js_1.opTapSync; } });
20
- Object.defineProperty(exports, "opUnique", { enumerable: true, get: function () { return index_js_1.opUniqueSync; } });
21
- var pipe_js_1 = require("../pipe.js");
22
- Object.defineProperty(exports, "pipe", { enumerable: true, get: function () { return pipe_js_1.pipeSync; } });
23
- Object.defineProperty(exports, "pipeSync", { enumerable: true, get: function () { return pipe_js_1.pipeSync; } });
24
- var reduce_js_1 = require("../reduce.js");
25
- Object.defineProperty(exports, "reduce", { enumerable: true, get: function () { return reduce_js_1.reduceSync; } });
26
- //# sourceMappingURL=index.js.map
@@ -1,13 +0,0 @@
1
- /**
2
- * Allows an iterable to be shared by multiple consumers.
3
- * Each consumer takes from the iterable.
4
- * @param iterable - the iterable to share
5
- */
6
- export declare function toDistributableIterableSync<T>(iterable: Iterable<T>): Iterable<T>;
7
- /**
8
- * Allows an iterable to be shared by multiple consumers.
9
- * Each consumer takes from the iterable.
10
- * @param iterable - the iterable to share
11
- */
12
- export declare const toDistributableIterable: typeof toDistributableIterableSync;
13
- //# sourceMappingURL=distribute.d.mts.map
@@ -1,13 +0,0 @@
1
- /**
2
- * Allows an iterable to be shared by multiple consumers.
3
- * Each consumer takes from the iterable.
4
- * @param iterable - the iterable to share
5
- */
6
- export declare function toDistributableIterableSync<T>(iterable: Iterable<T>): Iterable<T>;
7
- /**
8
- * Allows an iterable to be shared by multiple consumers.
9
- * Each consumer takes from the iterable.
10
- * @param iterable - the iterable to share
11
- */
12
- export declare const toDistributableIterable: typeof toDistributableIterableSync;
13
- //# sourceMappingURL=distribute.d.ts.map
@@ -1,32 +0,0 @@
1
- /**
2
- * Allows an iterable to be shared by multiple consumers.
3
- * Each consumer takes from the iterable.
4
- * @param iterable - the iterable to share
5
- */
6
- export function toDistributableIterableSync(iterable) {
7
- let lastValue;
8
- let iter;
9
- function getNext() {
10
- if (lastValue && lastValue.done) {
11
- return { ...lastValue };
12
- }
13
- iter = iter || iterable[Symbol.iterator]();
14
- lastValue = iter.next();
15
- return lastValue;
16
- }
17
- function* iterableFn() {
18
- let next;
19
- while (!(next = getNext()).done) {
20
- yield next.value;
21
- }
22
- }
23
- return {
24
- [Symbol.iterator]: iterableFn,
25
- };
26
- }
27
- /**
28
- * Allows an iterable to be shared by multiple consumers.
29
- * Each consumer takes from the iterable.
30
- * @param iterable - the iterable to share
31
- */
32
- export const toDistributableIterable = toDistributableIterableSync;
@@ -1,7 +0,0 @@
1
- export { toDistributableIterable } from './distribute.mjs';
2
- export { interleave } from './interleave.mjs';
3
- export { asyncIteratorToAsyncIterable, iteratorToIterable } from './iteratorToIterable.mjs';
4
- export { toArray } from './toArray.mjs';
5
- export { toAsyncIterable } from './toAsyncIterable.mjs';
6
- export { isAsyncIterable } from './util.mjs';
7
- //# sourceMappingURL=index.d.mts.map
@@ -1,7 +0,0 @@
1
- export { toDistributableIterable } from './distribute.js';
2
- export { interleave } from './interleave.js';
3
- export { asyncIteratorToAsyncIterable, iteratorToIterable } from './iteratorToIterable.js';
4
- export { toArray } from './toArray.js';
5
- export { toAsyncIterable } from './toAsyncIterable.js';
6
- export { isAsyncIterable } from './util.js';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1,6 +0,0 @@
1
- export { toDistributableIterable } from './distribute.mjs';
2
- export { interleave } from './interleave.mjs';
3
- export { asyncIteratorToAsyncIterable, iteratorToIterable } from './iteratorToIterable.mjs';
4
- export { toArray } from './toArray.mjs';
5
- export { toAsyncIterable } from './toAsyncIterable.mjs';
6
- export { isAsyncIterable } from './util.mjs';
@@ -1,2 +0,0 @@
1
- export declare function interleave<T>(a: Iterable<T>, b: Iterable<T>): Iterable<T>;
2
- //# sourceMappingURL=interleave.d.mts.map
@@ -1,2 +0,0 @@
1
- export declare function interleave<T>(a: Iterable<T>, b: Iterable<T>): Iterable<T>;
2
- //# sourceMappingURL=interleave.d.ts.map
@@ -1,17 +0,0 @@
1
- export function* interleave(a, b) {
2
- const ai = a[Symbol.iterator]();
3
- const bi = b[Symbol.iterator]();
4
- for (let aNext = ai.next(); !aNext.done; aNext = ai.next()) {
5
- yield aNext.value;
6
- const bNext = bi.next();
7
- if (bNext.done)
8
- break;
9
- yield bNext.value;
10
- }
11
- for (let aNext = ai.next(); !aNext.done; aNext = ai.next()) {
12
- yield aNext.value;
13
- }
14
- for (let bNext = bi.next(); !bNext.done; bNext = bi.next()) {
15
- yield bNext.value;
16
- }
17
- }
@@ -1,3 +0,0 @@
1
- export declare function iteratorToIterable<T>(iterator: Iterator<T>): Iterable<T>;
2
- export declare function asyncIteratorToAsyncIterable<T>(iterator: AsyncIterator<T> | Iterator<T>): AsyncIterable<T>;
3
- //# sourceMappingURL=iteratorToIterable.d.mts.map
@@ -1,3 +0,0 @@
1
- export declare function iteratorToIterable<T>(iterator: Iterator<T>): Iterable<T>;
2
- export declare function asyncIteratorToAsyncIterable<T>(iterator: AsyncIterator<T> | Iterator<T>): AsyncIterable<T>;
3
- //# sourceMappingURL=iteratorToIterable.d.ts.map
@@ -1,12 +0,0 @@
1
- export function* iteratorToIterable(iterator) {
2
- let n;
3
- while (!(n = iterator.next()).done) {
4
- yield n.value;
5
- }
6
- }
7
- export async function* asyncIteratorToAsyncIterable(iterator) {
8
- let n;
9
- while (!(n = await iterator.next()).done) {
10
- yield n.value;
11
- }
12
- }
@@ -1,6 +0,0 @@
1
- export declare function toArray<T>(i: AsyncIterable<T>): Promise<Awaited<T>[]>;
2
- export declare function toArray<T>(i: Iterable<T>): T[];
3
- export declare function toArray<T>(i: Iterable<T> | AsyncIterable<T>): T[] | Promise<Awaited<T>[]>;
4
- export declare function toArraySync<T>(iter: Iterable<T>): T[];
5
- export declare function toArrayAsync<T>(iter: AsyncIterable<T>): Promise<Awaited<T>[]>;
6
- //# sourceMappingURL=toArray.d.mts.map
@@ -1,6 +0,0 @@
1
- export declare function toArray<T>(i: AsyncIterable<T>): Promise<Awaited<T>[]>;
2
- export declare function toArray<T>(i: Iterable<T>): T[];
3
- export declare function toArray<T>(i: Iterable<T> | AsyncIterable<T>): T[] | Promise<Awaited<T>[]>;
4
- export declare function toArraySync<T>(iter: Iterable<T>): T[];
5
- export declare function toArrayAsync<T>(iter: AsyncIterable<T>): Promise<Awaited<T>[]>;
6
- //# sourceMappingURL=toArray.d.ts.map
@@ -1,14 +0,0 @@
1
- import { isAsyncIterable } from './util.mjs';
2
- export function toArray(i) {
3
- return isAsyncIterable(i) ? toArrayAsync(i) : toArraySync(i);
4
- }
5
- export function toArraySync(iter) {
6
- return [...iter];
7
- }
8
- export async function toArrayAsync(iter) {
9
- const collection = [];
10
- for await (const i of iter) {
11
- collection.push(i);
12
- }
13
- return collection;
14
- }
@@ -1,11 +0,0 @@
1
- import type { AnyIterable } from '../internalTypes.mjs';
2
- export declare function mergeAsyncIterables<T>(iter: Iterable<T>): AsyncIterable<T>;
3
- export declare function mergeAsyncIterables<T>(iter: AsyncIterable<T>): AsyncIterable<T>;
4
- export declare function mergeAsyncIterables<T>(iter: Promise<Iterable<T>>): AsyncIterable<T>;
5
- export declare function mergeAsyncIterables<T>(iter: AnyIterable<T>): AsyncIterable<T>;
6
- export declare function mergeAsyncIterables<T>(iter: AnyIterable<T>, ...rest: AnyIterable<T>[]): AsyncIterable<T>;
7
- /**
8
- * Convert one or more iterables to an AsyncIterable
9
- */
10
- export declare const toAsyncIterable: typeof mergeAsyncIterables;
11
- //# sourceMappingURL=toAsyncIterable.d.mts.map
@@ -1,11 +0,0 @@
1
- import type { AnyIterable } from '../internalTypes.js';
2
- export declare function mergeAsyncIterables<T>(iter: Iterable<T>): AsyncIterable<T>;
3
- export declare function mergeAsyncIterables<T>(iter: AsyncIterable<T>): AsyncIterable<T>;
4
- export declare function mergeAsyncIterables<T>(iter: Promise<Iterable<T>>): AsyncIterable<T>;
5
- export declare function mergeAsyncIterables<T>(iter: AnyIterable<T>): AsyncIterable<T>;
6
- export declare function mergeAsyncIterables<T>(iter: AnyIterable<T>, ...rest: AnyIterable<T>[]): AsyncIterable<T>;
7
- /**
8
- * Convert one or more iterables to an AsyncIterable
9
- */
10
- export declare const toAsyncIterable: typeof mergeAsyncIterables;
11
- //# sourceMappingURL=toAsyncIterable.d.ts.map
@@ -1,14 +0,0 @@
1
- /**
2
- * Merge multiple iterables into an AsyncIterable
3
- * @param iter - initial iterable.
4
- * @param rest - iterables to merge.
5
- */
6
- export async function* mergeAsyncIterables(iter, ...rest) {
7
- for await (const i of [iter, ...rest]) {
8
- yield* i;
9
- }
10
- }
11
- /**
12
- * Convert one or more iterables to an AsyncIterable
13
- */
14
- export const toAsyncIterable = mergeAsyncIterables;
@@ -1,4 +0,0 @@
1
- import type { AnyIterable, PipeFn, PipeFnAsync, PipeFnSync } from '../internalTypes.mjs';
2
- export declare function toPipeFn<T, U = T>(syncFn: PipeFnSync<T, U>, asyncFn: PipeFnAsync<T, U>): PipeFn<T, U>;
3
- export declare function isAsyncIterable<T>(i: AnyIterable<T>): i is AsyncIterable<T>;
4
- //# sourceMappingURL=util.d.mts.map
@@ -1,4 +0,0 @@
1
- import type { AnyIterable, PipeFn, PipeFnAsync, PipeFnSync } from '../internalTypes.js';
2
- export declare function toPipeFn<T, U = T>(syncFn: PipeFnSync<T, U>, asyncFn: PipeFnAsync<T, U>): PipeFn<T, U>;
3
- export declare function isAsyncIterable<T>(i: AnyIterable<T>): i is AsyncIterable<T>;
4
- //# sourceMappingURL=util.d.ts.map
@@ -1,9 +0,0 @@
1
- export function toPipeFn(syncFn, asyncFn) {
2
- function _(i) {
3
- return isAsyncIterable(i) ? asyncFn(i) : syncFn(i);
4
- }
5
- return _;
6
- }
7
- export function isAsyncIterable(i) {
8
- return typeof i[Symbol.asyncIterator] === 'function';
9
- }
@@ -1,9 +0,0 @@
1
- import * as _helpers from './helpers/index.mjs';
2
- import * as _operators from './operators/index.mjs';
3
- export { interleave, isAsyncIterable, toArray, toAsyncIterable, toDistributableIterable } from './helpers/index.mjs';
4
- export { opAppend, opAwaitAsync, opConcatMap, opFilter, opFirst, opFlatten, opJoinStrings, opLast, opMap, opSkip, opTake, opTap, opUnique, } from './operators/index.mjs';
5
- export { pipeAsync, pipeSync } from './pipe.mjs';
6
- export { reduce, reduceAsync, reduceSync } from './reduce.mjs';
7
- export declare const operators: typeof _operators;
8
- export declare const helpers: typeof _helpers;
9
- //# sourceMappingURL=index.d.mts.map