iter-fest 0.1.1-main.cfcce86 → 0.1.1-main.dd552c2

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 (200) hide show
  1. package/README.md +126 -45
  2. package/dist/chunk-2DE3J4J7.mjs +35 -0
  3. package/dist/chunk-2DE3J4J7.mjs.map +1 -0
  4. package/dist/chunk-3S6LCGE6.mjs +10 -0
  5. package/dist/chunk-3S6LCGE6.mjs.map +1 -0
  6. package/dist/chunk-ANRVAYLW.mjs +35 -0
  7. package/dist/chunk-ANRVAYLW.mjs.map +1 -0
  8. package/dist/chunk-BWMXKULC.mjs +46 -0
  9. package/dist/chunk-BWMXKULC.mjs.map +1 -0
  10. package/dist/chunk-FBST4AUL.mjs +10 -0
  11. package/dist/chunk-FBST4AUL.mjs.map +1 -0
  12. package/dist/chunk-FMIHIL6A.mjs +10 -0
  13. package/dist/chunk-FMIHIL6A.mjs.map +1 -0
  14. package/dist/chunk-KYMTQJIJ.mjs +10 -0
  15. package/dist/chunk-KYMTQJIJ.mjs.map +1 -0
  16. package/dist/chunk-LIMQXDFK.mjs +10 -0
  17. package/dist/chunk-LIMQXDFK.mjs.map +1 -0
  18. package/dist/chunk-OWUGLCQB.mjs +10 -0
  19. package/dist/chunk-OWUGLCQB.mjs.map +1 -0
  20. package/dist/chunk-P4OSZLEH.mjs +15 -0
  21. package/dist/chunk-P4OSZLEH.mjs.map +1 -0
  22. package/dist/chunk-QX6EMOSQ.mjs +10 -0
  23. package/dist/chunk-QX6EMOSQ.mjs.map +1 -0
  24. package/dist/chunk-R6SXIXMH.mjs +10 -0
  25. package/dist/chunk-R6SXIXMH.mjs.map +1 -0
  26. package/dist/chunk-TDHR35S7.mjs +10 -0
  27. package/dist/chunk-TDHR35S7.mjs.map +1 -0
  28. package/dist/chunk-VCKLUCOT.mjs +10 -0
  29. package/dist/chunk-VCKLUCOT.mjs.map +1 -0
  30. package/dist/chunk-XQDGXAAF.mjs +10 -0
  31. package/dist/chunk-XQDGXAAF.mjs.map +1 -0
  32. package/dist/{chunk-MOBXUTO5.mjs → chunk-YJSIVBF7.mjs} +5 -5
  33. package/dist/chunk-YJSIVBF7.mjs.map +1 -0
  34. package/dist/chunk-YLERARWI.mjs +10 -0
  35. package/dist/chunk-YLERARWI.mjs.map +1 -0
  36. package/dist/iter-fest.asyncGeneratorWithLastValue.d.mts +6 -0
  37. package/dist/iter-fest.asyncGeneratorWithLastValue.d.ts +6 -0
  38. package/dist/iter-fest.asyncGeneratorWithLastValue.js +59 -0
  39. package/dist/iter-fest.asyncGeneratorWithLastValue.js.map +1 -0
  40. package/dist/iter-fest.asyncGeneratorWithLastValue.mjs +7 -0
  41. package/dist/iter-fest.asyncIteratorToAsyncIterable.d.mts +3 -0
  42. package/dist/iter-fest.asyncIteratorToAsyncIterable.d.ts +3 -0
  43. package/dist/{iter-fest.iterableForEach.js → iter-fest.asyncIteratorToAsyncIterable.js} +15 -16
  44. package/dist/iter-fest.asyncIteratorToAsyncIterable.js.map +1 -0
  45. package/dist/iter-fest.asyncIteratorToAsyncIterable.mjs +7 -0
  46. package/dist/iter-fest.d.mts +17 -9
  47. package/dist/iter-fest.d.ts +17 -9
  48. package/dist/iter-fest.generatorWithLastValue.d.mts +6 -0
  49. package/dist/iter-fest.generatorWithLastValue.d.ts +6 -0
  50. package/dist/iter-fest.generatorWithLastValue.js +59 -0
  51. package/dist/iter-fest.generatorWithLastValue.js.map +1 -0
  52. package/dist/iter-fest.generatorWithLastValue.mjs +7 -0
  53. package/dist/iter-fest.iterableWritableStream.d.mts +7 -0
  54. package/dist/iter-fest.iterableWritableStream.d.ts +7 -0
  55. package/dist/{iter-fest.pushAsyncIterableIterator.js → iter-fest.iterableWritableStream.js} +39 -30
  56. package/dist/iter-fest.iterableWritableStream.js.map +1 -0
  57. package/dist/iter-fest.iterableWritableStream.mjs +7 -0
  58. package/dist/iter-fest.iteratorDrop.d.mts +12 -0
  59. package/dist/iter-fest.iteratorDrop.d.ts +12 -0
  60. package/dist/iter-fest.iteratorDrop.js +44 -0
  61. package/dist/iter-fest.iteratorDrop.js.map +1 -0
  62. package/dist/iter-fest.iteratorDrop.mjs +7 -0
  63. package/dist/iter-fest.iteratorEvery.d.mts +25 -0
  64. package/dist/iter-fest.iteratorEvery.d.ts +25 -0
  65. package/dist/iter-fest.iteratorEvery.js +44 -0
  66. package/dist/iter-fest.iteratorEvery.js.map +1 -0
  67. package/dist/iter-fest.iteratorEvery.mjs +7 -0
  68. package/dist/iter-fest.iteratorFilter.d.mts +18 -0
  69. package/dist/iter-fest.iteratorFilter.d.ts +18 -0
  70. package/dist/iter-fest.iteratorFilter.js +44 -0
  71. package/dist/iter-fest.iteratorFilter.js.map +1 -0
  72. package/dist/iter-fest.iteratorFilter.mjs +7 -0
  73. package/dist/iter-fest.iteratorFind.d.mts +14 -0
  74. package/dist/iter-fest.iteratorFind.d.ts +14 -0
  75. package/dist/iter-fest.iteratorFind.js +44 -0
  76. package/dist/iter-fest.iteratorFind.js.map +1 -0
  77. package/dist/iter-fest.iteratorFind.mjs +7 -0
  78. package/dist/iter-fest.iteratorFlatMap.d.mts +12 -0
  79. package/dist/iter-fest.iteratorFlatMap.d.ts +12 -0
  80. package/dist/iter-fest.iteratorFlatMap.js +44 -0
  81. package/dist/iter-fest.iteratorFlatMap.js.map +1 -0
  82. package/dist/iter-fest.iteratorFlatMap.mjs +7 -0
  83. package/dist/iter-fest.iteratorForEach.d.mts +10 -0
  84. package/dist/iter-fest.iteratorForEach.d.ts +10 -0
  85. package/dist/iter-fest.iteratorForEach.js +44 -0
  86. package/dist/iter-fest.iteratorForEach.js.map +1 -0
  87. package/dist/iter-fest.iteratorForEach.mjs +7 -0
  88. package/dist/iter-fest.iteratorForEach.mjs.map +1 -0
  89. package/dist/iter-fest.iteratorFrom.d.mts +12 -0
  90. package/dist/iter-fest.iteratorFrom.d.ts +12 -0
  91. package/dist/iter-fest.iteratorFrom.js +44 -0
  92. package/dist/iter-fest.iteratorFrom.js.map +1 -0
  93. package/dist/iter-fest.iteratorFrom.mjs +7 -0
  94. package/dist/iter-fest.iteratorFrom.mjs.map +1 -0
  95. package/dist/iter-fest.iteratorMap.d.mts +10 -0
  96. package/dist/iter-fest.iteratorMap.d.ts +10 -0
  97. package/dist/iter-fest.iteratorMap.js +44 -0
  98. package/dist/iter-fest.iteratorMap.js.map +1 -0
  99. package/dist/iter-fest.iteratorMap.mjs +7 -0
  100. package/dist/iter-fest.iteratorMap.mjs.map +1 -0
  101. package/dist/{iter-fest.iterableReduce.d.mts → iter-fest.iteratorReduce.d.mts} +13 -9
  102. package/dist/{iter-fest.iterableReduce.d.ts → iter-fest.iteratorReduce.d.ts} +13 -9
  103. package/dist/iter-fest.iteratorReduce.js +44 -0
  104. package/dist/iter-fest.iteratorReduce.js.map +1 -0
  105. package/dist/iter-fest.iteratorReduce.mjs +7 -0
  106. package/dist/iter-fest.iteratorReduce.mjs.map +1 -0
  107. package/dist/iter-fest.iteratorSome.d.mts +10 -0
  108. package/dist/iter-fest.iteratorSome.d.ts +10 -0
  109. package/dist/iter-fest.iteratorSome.js +44 -0
  110. package/dist/iter-fest.iteratorSome.js.map +1 -0
  111. package/dist/iter-fest.iteratorSome.mjs +7 -0
  112. package/dist/iter-fest.iteratorSome.mjs.map +1 -0
  113. package/dist/iter-fest.iteratorTake.d.mts +12 -0
  114. package/dist/iter-fest.iteratorTake.d.ts +12 -0
  115. package/dist/iter-fest.iteratorTake.js +44 -0
  116. package/dist/iter-fest.iteratorTake.js.map +1 -0
  117. package/dist/iter-fest.iteratorTake.mjs +7 -0
  118. package/dist/iter-fest.iteratorTake.mjs.map +1 -0
  119. package/dist/iter-fest.iteratorToArray.d.mts +13 -0
  120. package/dist/iter-fest.iteratorToArray.d.ts +13 -0
  121. package/dist/iter-fest.iteratorToArray.js +44 -0
  122. package/dist/iter-fest.iteratorToArray.js.map +1 -0
  123. package/dist/iter-fest.iteratorToArray.mjs +7 -0
  124. package/dist/iter-fest.iteratorToArray.mjs.map +1 -0
  125. package/dist/iter-fest.js +239 -164
  126. package/dist/iter-fest.js.map +1 -1
  127. package/dist/iter-fest.mjs +70 -38
  128. package/dist/iter-fest.readableStreamFrom.d.mts +3 -0
  129. package/dist/iter-fest.readableStreamFrom.d.ts +3 -0
  130. package/dist/{iter-fest.iterableGetReadable.js → iter-fest.readableStreamFrom.js} +9 -9
  131. package/dist/iter-fest.readableStreamFrom.js.map +1 -0
  132. package/dist/iter-fest.readableStreamFrom.mjs +7 -0
  133. package/dist/iter-fest.readableStreamFrom.mjs.map +1 -0
  134. package/package.json +167 -87
  135. package/dist/chunk-5CRMPYKD.mjs +0 -19
  136. package/dist/chunk-5CRMPYKD.mjs.map +0 -1
  137. package/dist/chunk-6C3P4TNK.mjs +0 -19
  138. package/dist/chunk-6C3P4TNK.mjs.map +0 -1
  139. package/dist/chunk-EZC33HE6.mjs +0 -15
  140. package/dist/chunk-EZC33HE6.mjs.map +0 -1
  141. package/dist/chunk-JU353VSE.mjs +0 -16
  142. package/dist/chunk-JU353VSE.mjs.map +0 -1
  143. package/dist/chunk-MNLOWKTC.mjs +0 -19
  144. package/dist/chunk-MNLOWKTC.mjs.map +0 -1
  145. package/dist/chunk-MOBXUTO5.mjs.map +0 -1
  146. package/dist/chunk-O5SQJUKB.mjs +0 -37
  147. package/dist/chunk-O5SQJUKB.mjs.map +0 -1
  148. package/dist/chunk-XW34KZRY.mjs +0 -17
  149. package/dist/chunk-XW34KZRY.mjs.map +0 -1
  150. package/dist/chunk-ZUBHGSCW.mjs +0 -18
  151. package/dist/chunk-ZUBHGSCW.mjs.map +0 -1
  152. package/dist/iter-fest.iterableEvery.d.mts +0 -24
  153. package/dist/iter-fest.iterableEvery.d.ts +0 -24
  154. package/dist/iter-fest.iterableEvery.js +0 -43
  155. package/dist/iter-fest.iterableEvery.js.map +0 -1
  156. package/dist/iter-fest.iterableEvery.mjs +0 -7
  157. package/dist/iter-fest.iterableFilter.d.mts +0 -16
  158. package/dist/iter-fest.iterableFilter.d.ts +0 -16
  159. package/dist/iter-fest.iterableFilter.js +0 -42
  160. package/dist/iter-fest.iterableFilter.js.map +0 -1
  161. package/dist/iter-fest.iterableFilter.mjs +0 -7
  162. package/dist/iter-fest.iterableFind.d.mts +0 -15
  163. package/dist/iter-fest.iterableFind.d.ts +0 -15
  164. package/dist/iter-fest.iterableFind.js +0 -43
  165. package/dist/iter-fest.iterableFind.js.map +0 -1
  166. package/dist/iter-fest.iterableFind.mjs +0 -7
  167. package/dist/iter-fest.iterableForEach.d.mts +0 -10
  168. package/dist/iter-fest.iterableForEach.d.ts +0 -10
  169. package/dist/iter-fest.iterableForEach.js.map +0 -1
  170. package/dist/iter-fest.iterableForEach.mjs +0 -7
  171. package/dist/iter-fest.iterableGetReadable.d.mts +0 -3
  172. package/dist/iter-fest.iterableGetReadable.d.ts +0 -3
  173. package/dist/iter-fest.iterableGetReadable.js.map +0 -1
  174. package/dist/iter-fest.iterableGetReadable.mjs +0 -7
  175. package/dist/iter-fest.iterableMap.d.mts +0 -8
  176. package/dist/iter-fest.iterableMap.d.ts +0 -8
  177. package/dist/iter-fest.iterableMap.js +0 -39
  178. package/dist/iter-fest.iterableMap.js.map +0 -1
  179. package/dist/iter-fest.iterableMap.mjs +0 -7
  180. package/dist/iter-fest.iterableReduce.js +0 -41
  181. package/dist/iter-fest.iterableReduce.js.map +0 -1
  182. package/dist/iter-fest.iterableReduce.mjs +0 -7
  183. package/dist/iter-fest.iterableSome.d.mts +0 -12
  184. package/dist/iter-fest.iterableSome.d.ts +0 -12
  185. package/dist/iter-fest.iterableSome.js +0 -43
  186. package/dist/iter-fest.iterableSome.js.map +0 -1
  187. package/dist/iter-fest.iterableSome.mjs +0 -7
  188. package/dist/iter-fest.pushAsyncIterableIterator.d.mts +0 -9
  189. package/dist/iter-fest.pushAsyncIterableIterator.d.ts +0 -9
  190. package/dist/iter-fest.pushAsyncIterableIterator.js.map +0 -1
  191. package/dist/iter-fest.pushAsyncIterableIterator.mjs +0 -7
  192. /package/dist/{iter-fest.iterableEvery.mjs.map → iter-fest.asyncGeneratorWithLastValue.mjs.map} +0 -0
  193. /package/dist/{iter-fest.iterableFilter.mjs.map → iter-fest.asyncIteratorToAsyncIterable.mjs.map} +0 -0
  194. /package/dist/{iter-fest.iterableFind.mjs.map → iter-fest.generatorWithLastValue.mjs.map} +0 -0
  195. /package/dist/{iter-fest.iterableForEach.mjs.map → iter-fest.iterableWritableStream.mjs.map} +0 -0
  196. /package/dist/{iter-fest.iterableGetReadable.mjs.map → iter-fest.iteratorDrop.mjs.map} +0 -0
  197. /package/dist/{iter-fest.iterableMap.mjs.map → iter-fest.iteratorEvery.mjs.map} +0 -0
  198. /package/dist/{iter-fest.iterableReduce.mjs.map → iter-fest.iteratorFilter.mjs.map} +0 -0
  199. /package/dist/{iter-fest.iterableSome.mjs.map → iter-fest.iteratorFind.mjs.map} +0 -0
  200. /package/dist/{iter-fest.pushAsyncIterableIterator.mjs.map → iter-fest.iteratorFlatMap.mjs.map} +0 -0
@@ -0,0 +1,10 @@
1
+ // src/iteratorMap.ts
2
+ import map from "core-js-pure/full/iterator/map";
3
+ function iteratorMap(iterator, callbackfn) {
4
+ return map(iterator, callbackfn);
5
+ }
6
+
7
+ export {
8
+ iteratorMap
9
+ };
10
+ //# sourceMappingURL=chunk-XQDGXAAF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iteratorMap.ts"],"sourcesContent":["// @ts-expect-error core-js-pure is not typed.\nimport map from 'core-js-pure/full/iterator/map';\n\n/**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n *\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorMap<T, U>(\n iterator: Iterator<T>,\n callbackfn: (value: T, index: number) => U\n): IterableIterator<U> {\n return map(iterator, callbackfn);\n}\n"],"mappings":";AACA,OAAO,SAAS;AAST,SAAS,YACd,UACA,YACqB;AACrB,SAAO,IAAI,UAAU,UAAU;AACjC;","names":[]}
@@ -1,9 +1,9 @@
1
- // src/iterableGetReadable.ts
1
+ // src/readableStreamFrom.ts
2
2
  function isIterable(iterable) {
3
3
  return !!(iterable && typeof iterable === "object" && Symbol.iterator in iterable);
4
4
  }
5
- function iterableGetReadable(iterable) {
6
- const iterator = isIterable(iterable) ? iterable[Symbol.iterator]() : iterable[Symbol.asyncIterator]();
5
+ function readableStreamFrom(anyIterable) {
6
+ const iterator = isIterable(anyIterable) ? anyIterable[Symbol.iterator]() : anyIterable[Symbol.asyncIterator]();
7
7
  return new ReadableStream({
8
8
  async pull(controller) {
9
9
  const result = await iterator.next();
@@ -17,6 +17,6 @@ function iterableGetReadable(iterable) {
17
17
  }
18
18
 
19
19
  export {
20
- iterableGetReadable
20
+ readableStreamFrom
21
21
  };
22
- //# sourceMappingURL=chunk-MOBXUTO5.mjs.map
22
+ //# sourceMappingURL=chunk-YJSIVBF7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/readableStreamFrom.ts"],"sourcesContent":["function isIterable(iterable: unknown): iterable is Iterable<unknown> {\n return !!(iterable && typeof iterable === 'object' && Symbol.iterator in iterable);\n}\n\nexport function readableStreamFrom<T>(anyIterable: AsyncIterable<T> | Iterable<T>): ReadableStream<T> {\n const iterator = isIterable(anyIterable) ? anyIterable[Symbol.iterator]() : anyIterable[Symbol.asyncIterator]();\n\n return new ReadableStream({\n async pull(controller) {\n const result = await iterator.next();\n\n if (result.done) {\n controller.close();\n } else {\n controller.enqueue(result.value);\n }\n }\n });\n}\n"],"mappings":";AAAA,SAAS,WAAW,UAAkD;AACpE,SAAO,CAAC,EAAE,YAAY,OAAO,aAAa,YAAY,OAAO,YAAY;AAC3E;AAEO,SAAS,mBAAsB,aAAgE;AACpG,QAAM,WAAW,WAAW,WAAW,IAAI,YAAY,OAAO,QAAQ,EAAE,IAAI,YAAY,OAAO,aAAa,EAAE;AAE9G,SAAO,IAAI,eAAe;AAAA,IACxB,MAAM,KAAK,YAAY;AACrB,YAAM,SAAS,MAAM,SAAS,KAAK;AAEnC,UAAI,OAAO,MAAM;AACf,mBAAW,MAAM;AAAA,MACnB,OAAO;AACL,mBAAW,QAAQ,OAAO,KAAK;AAAA,MACjC;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -0,0 +1,10 @@
1
+ // src/iteratorToArray.ts
2
+ import toArray from "core-js-pure/full/iterator/to-array";
3
+ function iteratorToArray(iteratorLike) {
4
+ return toArray(iteratorLike);
5
+ }
6
+
7
+ export {
8
+ iteratorToArray
9
+ };
10
+ //# sourceMappingURL=chunk-YLERARWI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iteratorToArray.ts"],"sourcesContent":["// @ts-expect-error core-js-pure is not typed.\nimport toArray from 'core-js-pure/full/iterator/to-array';\n\ntype IteratorLike<T> = Pick<Iterator<T>, 'next'>;\n\n/**\n * When you have a non-infinite iterator which you wish to transform into an array, you can do so with the builtin toArray method.\n *\n * @param limit\n *\n * @return Returns an Array containing the values from the iterator.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorToArray<T>(iteratorLike: IteratorLike<T>): T[] {\n return toArray(iteratorLike);\n}\n"],"mappings":";AACA,OAAO,aAAa;AAab,SAAS,gBAAmB,cAAoC;AACrE,SAAO,QAAQ,YAAY;AAC7B;","names":[]}
@@ -0,0 +1,6 @@
1
+ type AsyncGeneratorWithLastValue<T = unknown, TReturn = any, TNext = unknown> = AsyncGenerator<T, TReturn, TNext> & {
2
+ lastValue(): TReturn;
3
+ };
4
+ declare function asyncGeneratorWithLastValue<T = unknown, TReturn = any, TNext = unknown>(generator: AsyncGenerator<T, TReturn, TNext>): AsyncGeneratorWithLastValue<T, TReturn, TNext>;
5
+
6
+ export { type AsyncGeneratorWithLastValue, asyncGeneratorWithLastValue };
@@ -0,0 +1,6 @@
1
+ type AsyncGeneratorWithLastValue<T = unknown, TReturn = any, TNext = unknown> = AsyncGenerator<T, TReturn, TNext> & {
2
+ lastValue(): TReturn;
3
+ };
4
+ declare function asyncGeneratorWithLastValue<T = unknown, TReturn = any, TNext = unknown>(generator: AsyncGenerator<T, TReturn, TNext>): AsyncGeneratorWithLastValue<T, TReturn, TNext>;
5
+
6
+ export { type AsyncGeneratorWithLastValue, asyncGeneratorWithLastValue };
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/asyncGeneratorWithLastValue.ts
21
+ var asyncGeneratorWithLastValue_exports = {};
22
+ __export(asyncGeneratorWithLastValue_exports, {
23
+ asyncGeneratorWithLastValue: () => asyncGeneratorWithLastValue
24
+ });
25
+ module.exports = __toCommonJS(asyncGeneratorWithLastValue_exports);
26
+ var STILL_ITERATING = Symbol();
27
+ function asyncGeneratorWithLastValue(generator) {
28
+ let lastValue = STILL_ITERATING;
29
+ const asyncGeneratorWithLastValue2 = {
30
+ [Symbol.asyncIterator]() {
31
+ return asyncGeneratorWithLastValue2;
32
+ },
33
+ lastValue() {
34
+ if (lastValue === STILL_ITERATING) {
35
+ throw new Error("Iteration has not complete yet, cannot get last value.");
36
+ }
37
+ return lastValue;
38
+ },
39
+ async next(next) {
40
+ const result = await generator.next(next);
41
+ if (result.done) {
42
+ lastValue = result.value;
43
+ }
44
+ return result;
45
+ },
46
+ return(value) {
47
+ return generator.return(value);
48
+ },
49
+ throw(error) {
50
+ return generator.throw(error);
51
+ }
52
+ };
53
+ return asyncGeneratorWithLastValue2;
54
+ }
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ asyncGeneratorWithLastValue
58
+ });
59
+ //# sourceMappingURL=iter-fest.asyncGeneratorWithLastValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/asyncGeneratorWithLastValue.ts"],"sourcesContent":["const STILL_ITERATING = Symbol();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AsyncGeneratorWithLastValue<T = unknown, TReturn = any, TNext = unknown> = AsyncGenerator<\n T,\n TReturn,\n TNext\n> & {\n lastValue(): TReturn;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function asyncGeneratorWithLastValue<T = unknown, TReturn = any, TNext = unknown>(\n generator: AsyncGenerator<T, TReturn, TNext>\n): AsyncGeneratorWithLastValue<T, TReturn, TNext> {\n let lastValue: typeof STILL_ITERATING | TReturn = STILL_ITERATING;\n\n const asyncGeneratorWithLastValue = {\n [Symbol.asyncIterator]() {\n return asyncGeneratorWithLastValue;\n },\n lastValue(): TReturn {\n if (lastValue === STILL_ITERATING) {\n throw new Error('Iteration has not complete yet, cannot get last value.');\n }\n\n return lastValue;\n },\n async next(next: TNext) {\n const result = await generator.next(next);\n\n if (result.done) {\n lastValue = result.value;\n }\n\n return result;\n },\n return(value: TReturn) {\n return generator.return(value);\n },\n throw(error: unknown) {\n return generator.throw(error);\n }\n };\n\n return asyncGeneratorWithLastValue;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAM,kBAAkB,OAAO;AAYxB,SAAS,4BACd,WACgD;AAChD,MAAI,YAA8C;AAElD,QAAMA,+BAA8B;AAAA,IAClC,CAAC,OAAO,aAAa,IAAI;AACvB,aAAOA;AAAA,IACT;AAAA,IACA,YAAqB;AACnB,UAAI,cAAc,iBAAiB;AACjC,cAAM,IAAI,MAAM,wDAAwD;AAAA,MAC1E;AAEA,aAAO;AAAA,IACT;AAAA,IACA,MAAM,KAAK,MAAa;AACtB,YAAM,SAAS,MAAM,UAAU,KAAK,IAAI;AAExC,UAAI,OAAO,MAAM;AACf,oBAAY,OAAO;AAAA,MACrB;AAEA,aAAO;AAAA,IACT;AAAA,IACA,OAAO,OAAgB;AACrB,aAAO,UAAU,OAAO,KAAK;AAAA,IAC/B;AAAA,IACA,MAAM,OAAgB;AACpB,aAAO,UAAU,MAAM,KAAK;AAAA,IAC9B;AAAA,EACF;AAEA,SAAOA;AACT;","names":["asyncGeneratorWithLastValue"]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ asyncGeneratorWithLastValue
3
+ } from "./chunk-ANRVAYLW.mjs";
4
+ export {
5
+ asyncGeneratorWithLastValue
6
+ };
7
+ //# sourceMappingURL=iter-fest.asyncGeneratorWithLastValue.mjs.map
@@ -0,0 +1,3 @@
1
+ declare function asyncIteratorToAsyncIterable<T>(asyncIterator: AsyncIterator<T>): AsyncIterableIterator<T>;
2
+
3
+ export { asyncIteratorToAsyncIterable };
@@ -0,0 +1,3 @@
1
+ declare function asyncIteratorToAsyncIterable<T>(asyncIterator: AsyncIterator<T>): AsyncIterableIterator<T>;
2
+
3
+ export { asyncIteratorToAsyncIterable };
@@ -17,24 +17,23 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/iterableForEach.ts
21
- var iterableForEach_exports = {};
22
- __export(iterableForEach_exports, {
23
- iterableForEach: () => iterableForEach
20
+ // src/asyncIteratorToAsyncIterable.ts
21
+ var asyncIteratorToAsyncIterable_exports = {};
22
+ __export(asyncIteratorToAsyncIterable_exports, {
23
+ asyncIteratorToAsyncIterable: () => asyncIteratorToAsyncIterable
24
24
  });
25
- module.exports = __toCommonJS(iterableForEach_exports);
26
- function iterableForEach(iterable, callbackfn, thisArg) {
27
- let index = 0;
28
- if (typeof callbackfn !== "function") {
29
- throw new TypeError(`${callbackfn} is not a function`);
30
- }
31
- const boundCallbackfn = callbackfn.bind(thisArg);
32
- for (const value of iterable) {
33
- boundCallbackfn(value, index++, iterable);
34
- }
25
+ module.exports = __toCommonJS(asyncIteratorToAsyncIterable_exports);
26
+ function asyncIteratorToAsyncIterable(asyncIterator) {
27
+ const asyncIterableIterator = {
28
+ [Symbol.asyncIterator]: () => asyncIterableIterator,
29
+ next: asyncIterator.next.bind(asyncIterator),
30
+ ...asyncIterator.return ? { return: asyncIterator.return.bind(asyncIterator) } : {},
31
+ ...asyncIterator.throw ? { throw: asyncIterator.throw.bind(asyncIterator) } : {}
32
+ };
33
+ return asyncIterableIterator;
35
34
  }
36
35
  // Annotate the CommonJS export names for ESM import in node:
37
36
  0 && (module.exports = {
38
- iterableForEach
37
+ asyncIteratorToAsyncIterable
39
38
  });
40
- //# sourceMappingURL=iter-fest.iterableForEach.js.map
39
+ //# sourceMappingURL=iter-fest.asyncIteratorToAsyncIterable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/asyncIteratorToAsyncIterable.ts"],"sourcesContent":["export function asyncIteratorToAsyncIterable<T>(asyncIterator: AsyncIterator<T>): AsyncIterableIterator<T> {\n const asyncIterableIterator: AsyncIterableIterator<T> = {\n [Symbol.asyncIterator]: () => asyncIterableIterator,\n next: asyncIterator.next.bind(asyncIterator),\n ...(asyncIterator.return ? { return: asyncIterator.return.bind(asyncIterator) } : {}),\n ...(asyncIterator.throw ? { throw: asyncIterator.throw.bind(asyncIterator) } : {})\n };\n\n return asyncIterableIterator;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,6BAAgC,eAA2D;AACzG,QAAM,wBAAkD;AAAA,IACtD,CAAC,OAAO,aAAa,GAAG,MAAM;AAAA,IAC9B,MAAM,cAAc,KAAK,KAAK,aAAa;AAAA,IAC3C,GAAI,cAAc,SAAS,EAAE,QAAQ,cAAc,OAAO,KAAK,aAAa,EAAE,IAAI,CAAC;AAAA,IACnF,GAAI,cAAc,QAAQ,EAAE,OAAO,cAAc,MAAM,KAAK,aAAa,EAAE,IAAI,CAAC;AAAA,EAClF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ asyncIteratorToAsyncIterable
3
+ } from "./chunk-P4OSZLEH.mjs";
4
+ export {
5
+ asyncIteratorToAsyncIterable
6
+ };
7
+ //# sourceMappingURL=iter-fest.asyncIteratorToAsyncIterable.mjs.map
@@ -1,29 +1,37 @@
1
1
  export { CompleteFunction, ErrorFunction, NextFunction, Observable, Observer, StartFunction, SubscriberFunction, Subscription, SubscriptionObserver } from './iter-fest.observable.mjs';
2
- export { PushAsyncIterableIterator } from './iter-fest.pushAsyncIterableIterator.mjs';
3
2
  export { SymbolObservable } from './iter-fest.symbolObservable.mjs';
3
+ export { AsyncGeneratorWithLastValue, asyncGeneratorWithLastValue } from './iter-fest.asyncGeneratorWithLastValue.mjs';
4
+ export { asyncIteratorToAsyncIterable } from './iter-fest.asyncIteratorToAsyncIterable.mjs';
5
+ export { GeneratorWithLastValue, generatorWithLastValue } from './iter-fest.generatorWithLastValue.mjs';
4
6
  export { iterableAt } from './iter-fest.iterableAt.mjs';
5
7
  export { iterableConcat } from './iter-fest.iterableConcat.mjs';
6
8
  export { iterableEntries } from './iter-fest.iterableEntries.mjs';
7
- export { iterableEvery } from './iter-fest.iterableEvery.mjs';
8
- export { iterableFilter } from './iter-fest.iterableFilter.mjs';
9
- export { iterableFind } from './iter-fest.iterableFind.mjs';
10
9
  export { iterableFindIndex } from './iter-fest.iterableFindIndex.mjs';
11
10
  export { iterableFindLast } from './iter-fest.iterableFindLast.mjs';
12
11
  export { iterableFindLastIndex } from './iter-fest.iterableFindLastIndex.mjs';
13
- export { iterableForEach } from './iter-fest.iterableForEach.mjs';
14
- export { iterableGetReadable } from './iter-fest.iterableGetReadable.mjs';
15
12
  export { iterableIncludes } from './iter-fest.iterableIncludes.mjs';
16
13
  export { iterableIndexOf } from './iter-fest.iterableIndexOf.mjs';
17
14
  export { iterableJoin } from './iter-fest.iterableJoin.mjs';
18
15
  export { iterableKeys } from './iter-fest.iterableKeys.mjs';
19
- export { iterableMap } from './iter-fest.iterableMap.mjs';
20
- export { iterableReduce } from './iter-fest.iterableReduce.mjs';
21
16
  export { iterableSlice } from './iter-fest.iterableSlice.mjs';
22
- export { iterableSome } from './iter-fest.iterableSome.mjs';
23
17
  export { iterableToSpliced } from './iter-fest.iterableToSpliced.mjs';
24
18
  export { iterableToString } from './iter-fest.iterableToString.mjs';
19
+ export { IterableWritableStream } from './iter-fest.iterableWritableStream.mjs';
20
+ export { iteratorDrop } from './iter-fest.iteratorDrop.mjs';
21
+ export { iteratorEvery } from './iter-fest.iteratorEvery.mjs';
22
+ export { iteratorFilter } from './iter-fest.iteratorFilter.mjs';
23
+ export { iteratorFind } from './iter-fest.iteratorFind.mjs';
24
+ export { iteratorFlatMap } from './iter-fest.iteratorFlatMap.mjs';
25
+ export { iteratorForEach } from './iter-fest.iteratorForEach.mjs';
26
+ export { iteratorFrom } from './iter-fest.iteratorFrom.mjs';
27
+ export { iteratorMap } from './iter-fest.iteratorMap.mjs';
28
+ export { iteratorReduce } from './iter-fest.iteratorReduce.mjs';
29
+ export { iteratorSome } from './iter-fest.iteratorSome.mjs';
30
+ export { iteratorTake } from './iter-fest.iteratorTake.mjs';
31
+ export { iteratorToArray } from './iter-fest.iteratorToArray.mjs';
25
32
  export { iteratorToIterable } from './iter-fest.iteratorToIterable.mjs';
26
33
  export { observableFromAsync } from './iter-fest.observableFromAsync.mjs';
27
34
  export { observableSubscribeAsReadable } from './iter-fest.observableSubscribeAsReadable.mjs';
35
+ export { readableStreamFrom } from './iter-fest.readableStreamFrom.mjs';
28
36
  export { readerValues } from './iter-fest.readerValues.mjs';
29
37
  import 'core-js-pure/full/observable';
@@ -1,29 +1,37 @@
1
1
  export { CompleteFunction, ErrorFunction, NextFunction, Observable, Observer, StartFunction, SubscriberFunction, Subscription, SubscriptionObserver } from './iter-fest.observable.js';
2
- export { PushAsyncIterableIterator } from './iter-fest.pushAsyncIterableIterator.js';
3
2
  export { SymbolObservable } from './iter-fest.symbolObservable.js';
3
+ export { AsyncGeneratorWithLastValue, asyncGeneratorWithLastValue } from './iter-fest.asyncGeneratorWithLastValue.js';
4
+ export { asyncIteratorToAsyncIterable } from './iter-fest.asyncIteratorToAsyncIterable.js';
5
+ export { GeneratorWithLastValue, generatorWithLastValue } from './iter-fest.generatorWithLastValue.js';
4
6
  export { iterableAt } from './iter-fest.iterableAt.js';
5
7
  export { iterableConcat } from './iter-fest.iterableConcat.js';
6
8
  export { iterableEntries } from './iter-fest.iterableEntries.js';
7
- export { iterableEvery } from './iter-fest.iterableEvery.js';
8
- export { iterableFilter } from './iter-fest.iterableFilter.js';
9
- export { iterableFind } from './iter-fest.iterableFind.js';
10
9
  export { iterableFindIndex } from './iter-fest.iterableFindIndex.js';
11
10
  export { iterableFindLast } from './iter-fest.iterableFindLast.js';
12
11
  export { iterableFindLastIndex } from './iter-fest.iterableFindLastIndex.js';
13
- export { iterableForEach } from './iter-fest.iterableForEach.js';
14
- export { iterableGetReadable } from './iter-fest.iterableGetReadable.js';
15
12
  export { iterableIncludes } from './iter-fest.iterableIncludes.js';
16
13
  export { iterableIndexOf } from './iter-fest.iterableIndexOf.js';
17
14
  export { iterableJoin } from './iter-fest.iterableJoin.js';
18
15
  export { iterableKeys } from './iter-fest.iterableKeys.js';
19
- export { iterableMap } from './iter-fest.iterableMap.js';
20
- export { iterableReduce } from './iter-fest.iterableReduce.js';
21
16
  export { iterableSlice } from './iter-fest.iterableSlice.js';
22
- export { iterableSome } from './iter-fest.iterableSome.js';
23
17
  export { iterableToSpliced } from './iter-fest.iterableToSpliced.js';
24
18
  export { iterableToString } from './iter-fest.iterableToString.js';
19
+ export { IterableWritableStream } from './iter-fest.iterableWritableStream.js';
20
+ export { iteratorDrop } from './iter-fest.iteratorDrop.js';
21
+ export { iteratorEvery } from './iter-fest.iteratorEvery.js';
22
+ export { iteratorFilter } from './iter-fest.iteratorFilter.js';
23
+ export { iteratorFind } from './iter-fest.iteratorFind.js';
24
+ export { iteratorFlatMap } from './iter-fest.iteratorFlatMap.js';
25
+ export { iteratorForEach } from './iter-fest.iteratorForEach.js';
26
+ export { iteratorFrom } from './iter-fest.iteratorFrom.js';
27
+ export { iteratorMap } from './iter-fest.iteratorMap.js';
28
+ export { iteratorReduce } from './iter-fest.iteratorReduce.js';
29
+ export { iteratorSome } from './iter-fest.iteratorSome.js';
30
+ export { iteratorTake } from './iter-fest.iteratorTake.js';
31
+ export { iteratorToArray } from './iter-fest.iteratorToArray.js';
25
32
  export { iteratorToIterable } from './iter-fest.iteratorToIterable.js';
26
33
  export { observableFromAsync } from './iter-fest.observableFromAsync.js';
27
34
  export { observableSubscribeAsReadable } from './iter-fest.observableSubscribeAsReadable.js';
35
+ export { readableStreamFrom } from './iter-fest.readableStreamFrom.js';
28
36
  export { readerValues } from './iter-fest.readerValues.js';
29
37
  import 'core-js-pure/full/observable';
@@ -0,0 +1,6 @@
1
+ type GeneratorWithLastValue<T = unknown, TReturn = any, TNext = unknown> = Generator<T, TReturn, TNext> & {
2
+ lastValue(): TReturn;
3
+ };
4
+ declare function generatorWithLastValue<T = unknown, TReturn = any, TNext = unknown>(generator: Generator<T, TReturn, TNext>): GeneratorWithLastValue<T, TReturn, TNext>;
5
+
6
+ export { type GeneratorWithLastValue, generatorWithLastValue };
@@ -0,0 +1,6 @@
1
+ type GeneratorWithLastValue<T = unknown, TReturn = any, TNext = unknown> = Generator<T, TReturn, TNext> & {
2
+ lastValue(): TReturn;
3
+ };
4
+ declare function generatorWithLastValue<T = unknown, TReturn = any, TNext = unknown>(generator: Generator<T, TReturn, TNext>): GeneratorWithLastValue<T, TReturn, TNext>;
5
+
6
+ export { type GeneratorWithLastValue, generatorWithLastValue };
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/generatorWithLastValue.ts
21
+ var generatorWithLastValue_exports = {};
22
+ __export(generatorWithLastValue_exports, {
23
+ generatorWithLastValue: () => generatorWithLastValue
24
+ });
25
+ module.exports = __toCommonJS(generatorWithLastValue_exports);
26
+ var STILL_ITERATING = Symbol();
27
+ function generatorWithLastValue(generator) {
28
+ let lastValue = STILL_ITERATING;
29
+ const generatorWithLastValue2 = {
30
+ [Symbol.iterator]() {
31
+ return generatorWithLastValue2;
32
+ },
33
+ lastValue() {
34
+ if (lastValue === STILL_ITERATING) {
35
+ throw new Error("Iteration has not complete yet, cannot get last value.");
36
+ }
37
+ return lastValue;
38
+ },
39
+ next(next) {
40
+ const result = generator.next(next);
41
+ if (result.done) {
42
+ lastValue = result.value;
43
+ }
44
+ return result;
45
+ },
46
+ return(value) {
47
+ return generator.return(value);
48
+ },
49
+ throw(error) {
50
+ return generator.throw(error);
51
+ }
52
+ };
53
+ return generatorWithLastValue2;
54
+ }
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ generatorWithLastValue
58
+ });
59
+ //# sourceMappingURL=iter-fest.generatorWithLastValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/generatorWithLastValue.ts"],"sourcesContent":["const STILL_ITERATING = Symbol();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type GeneratorWithLastValue<T = unknown, TReturn = any, TNext = unknown> = Generator<T, TReturn, TNext> & {\n lastValue(): TReturn;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function generatorWithLastValue<T = unknown, TReturn = any, TNext = unknown>(\n generator: Generator<T, TReturn, TNext>\n): GeneratorWithLastValue<T, TReturn, TNext> {\n let lastValue: typeof STILL_ITERATING | TReturn = STILL_ITERATING;\n\n const generatorWithLastValue = {\n [Symbol.iterator]() {\n return generatorWithLastValue;\n },\n lastValue(): TReturn {\n if (lastValue === STILL_ITERATING) {\n throw new Error('Iteration has not complete yet, cannot get last value.');\n }\n\n return lastValue;\n },\n next(next: TNext) {\n const result = generator.next(next);\n\n if (result.done) {\n lastValue = result.value;\n }\n\n return result;\n },\n return(value: TReturn) {\n return generator.return(value);\n },\n throw(error: unknown) {\n return generator.throw(error);\n }\n };\n\n return generatorWithLastValue;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAM,kBAAkB,OAAO;AAQxB,SAAS,uBACd,WAC2C;AAC3C,MAAI,YAA8C;AAElD,QAAMA,0BAAyB;AAAA,IAC7B,CAAC,OAAO,QAAQ,IAAI;AAClB,aAAOA;AAAA,IACT;AAAA,IACA,YAAqB;AACnB,UAAI,cAAc,iBAAiB;AACjC,cAAM,IAAI,MAAM,wDAAwD;AAAA,MAC1E;AAEA,aAAO;AAAA,IACT;AAAA,IACA,KAAK,MAAa;AAChB,YAAM,SAAS,UAAU,KAAK,IAAI;AAElC,UAAI,OAAO,MAAM;AACf,oBAAY,OAAO;AAAA,MACrB;AAEA,aAAO;AAAA,IACT;AAAA,IACA,OAAO,OAAgB;AACrB,aAAO,UAAU,OAAO,KAAK;AAAA,IAC/B;AAAA,IACA,MAAM,OAAgB;AACpB,aAAO,UAAU,MAAM,KAAK;AAAA,IAC9B;AAAA,EACF;AAEA,SAAOA;AACT;","names":["generatorWithLastValue"]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ generatorWithLastValue
3
+ } from "./chunk-2DE3J4J7.mjs";
4
+ export {
5
+ generatorWithLastValue
6
+ };
7
+ //# sourceMappingURL=iter-fest.generatorWithLastValue.mjs.map
@@ -0,0 +1,7 @@
1
+ declare class IterableWritableStream<T> extends WritableStream<T> {
2
+ #private;
3
+ constructor();
4
+ [Symbol.asyncIterator](): AsyncIterator<T>;
5
+ }
6
+
7
+ export { IterableWritableStream };
@@ -0,0 +1,7 @@
1
+ declare class IterableWritableStream<T> extends WritableStream<T> {
2
+ #private;
3
+ constructor();
4
+ [Symbol.asyncIterator](): AsyncIterator<T>;
5
+ }
6
+
7
+ export { IterableWritableStream };
@@ -27,12 +27,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // src/PushAsyncIterableIterator.ts
31
- var PushAsyncIterableIterator_exports = {};
32
- __export(PushAsyncIterableIterator_exports, {
33
- PushAsyncIterableIterator: () => PushAsyncIterableIterator
30
+ // src/iterableWritableStream.ts
31
+ var iterableWritableStream_exports = {};
32
+ __export(iterableWritableStream_exports, {
33
+ IterableWritableStream: () => IterableWritableStream
34
34
  });
35
- module.exports = __toCommonJS(PushAsyncIterableIterator_exports);
35
+ module.exports = __toCommonJS(iterableWritableStream_exports);
36
36
 
37
37
  // src/private/withResolvers.ts
38
38
  var import_with_resolvers = __toESM(require("core-js-pure/full/promise/with-resolvers"));
@@ -40,34 +40,43 @@ function withResolvers() {
40
40
  return (0, import_with_resolvers.default)();
41
41
  }
42
42
 
43
- // src/PushAsyncIterableIterator.ts
44
- var CLOSE = Symbol("close");
45
- var PushAsyncIterableIterator = class {
46
- #closed = false;
47
- #pushResolvers = withResolvers();
48
- [Symbol.asyncIterator]() {
49
- return this;
50
- }
51
- close() {
52
- this.#closed = true;
53
- this.#pushResolvers.resolve(CLOSE);
43
+ // src/iterableWritableStream.ts
44
+ var CLOSE = Symbol();
45
+ var IterableWritableStream = class extends WritableStream {
46
+ constructor() {
47
+ super({
48
+ close: () => {
49
+ this.#buffer.push(CLOSE);
50
+ this.#writeResolvers.resolve();
51
+ },
52
+ write: (chunk) => {
53
+ this.#buffer.push(chunk);
54
+ this.#writeResolvers.resolve();
55
+ this.#writeResolvers = withResolvers();
56
+ }
57
+ });
54
58
  }
55
- async next() {
56
- const value = await this.#pushResolvers.promise;
57
- if (value === CLOSE) {
58
- return { done: true, value: void 0 };
59
- }
60
- return { done: false, value };
61
- }
62
- push(value) {
63
- if (!this.#closed) {
64
- this.#pushResolvers.resolve(value);
65
- this.#pushResolvers = withResolvers();
66
- }
59
+ #buffer = [];
60
+ #writeResolvers = withResolvers();
61
+ [Symbol.asyncIterator]() {
62
+ return {
63
+ next: async () => {
64
+ while (!this.#buffer.length) {
65
+ await this.#writeResolvers.promise;
66
+ }
67
+ const value = this.#buffer[0];
68
+ if (value === CLOSE) {
69
+ return { done: true, value: void 0 };
70
+ }
71
+ this.#buffer.shift();
72
+ await void 0;
73
+ return { done: false, value };
74
+ }
75
+ };
67
76
  }
68
77
  };
69
78
  // Annotate the CommonJS export names for ESM import in node:
70
79
  0 && (module.exports = {
71
- PushAsyncIterableIterator
80
+ IterableWritableStream
72
81
  });
73
- //# sourceMappingURL=iter-fest.pushAsyncIterableIterator.js.map
82
+ //# sourceMappingURL=iter-fest.iterableWritableStream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterableWritableStream.ts","../src/private/withResolvers.ts"],"sourcesContent":["import withResolvers from './private/withResolvers';\n\nconst CLOSE = Symbol();\n\nexport class IterableWritableStream<T> extends WritableStream<T> {\n constructor() {\n super({\n close: () => {\n this.#buffer.push(CLOSE);\n this.#writeResolvers.resolve();\n },\n write: (chunk: T) => {\n this.#buffer.push(chunk);\n this.#writeResolvers.resolve();\n this.#writeResolvers = withResolvers();\n }\n });\n }\n\n #buffer: (T | typeof CLOSE)[] = [];\n #writeResolvers: PromiseWithResolvers<void> = withResolvers();\n\n [Symbol.asyncIterator](): AsyncIterator<T> {\n return {\n next: async () => {\n while (!this.#buffer.length) {\n await this.#writeResolvers.promise;\n }\n\n const value = this.#buffer[0] as T | typeof CLOSE;\n\n if (value === CLOSE) {\n return { done: true, value: undefined };\n }\n\n // If it is not CLOSE, remove it from the queue.\n this.#buffer.shift();\n\n // Idle here so concurrent iteration has a chance to pick up the next value in a round robin fashion.\n await undefined;\n\n return { done: false, value };\n }\n };\n }\n}\n","// @ts-expect-error \"core-js\" is not typed.\nimport coreJSPromiseWithResolvers from 'core-js-pure/full/promise/with-resolvers';\n\nexport default function withResolvers<T>(): PromiseWithResolvers<T> {\n return coreJSPromiseWithResolvers();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,4BAAuC;AAExB,SAAR,gBAA6D;AAClE,aAAO,sBAAAA,SAA2B;AACpC;;;ADHA,IAAM,QAAQ,OAAO;AAEd,IAAM,yBAAN,cAAwC,eAAkB;AAAA,EAC/D,cAAc;AACZ,UAAM;AAAA,MACJ,OAAO,MAAM;AACX,aAAK,QAAQ,KAAK,KAAK;AACvB,aAAK,gBAAgB,QAAQ;AAAA,MAC/B;AAAA,MACA,OAAO,CAAC,UAAa;AACnB,aAAK,QAAQ,KAAK,KAAK;AACvB,aAAK,gBAAgB,QAAQ;AAC7B,aAAK,kBAAkB,cAAc;AAAA,MACvC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,UAAgC,CAAC;AAAA,EACjC,kBAA8C,cAAc;AAAA,EAE5D,CAAC,OAAO,aAAa,IAAsB;AACzC,WAAO;AAAA,MACL,MAAM,YAAY;AAChB,eAAO,CAAC,KAAK,QAAQ,QAAQ;AAC3B,gBAAM,KAAK,gBAAgB;AAAA,QAC7B;AAEA,cAAM,QAAQ,KAAK,QAAQ,CAAC;AAE5B,YAAI,UAAU,OAAO;AACnB,iBAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,QACxC;AAGA,aAAK,QAAQ,MAAM;AAGnB,cAAM;AAEN,eAAO,EAAE,MAAM,OAAO,MAAM;AAAA,MAC9B;AAAA,IACF;AAAA,EACF;AACF;","names":["coreJSPromiseWithResolvers"]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ IterableWritableStream
3
+ } from "./chunk-BWMXKULC.mjs";
4
+ export {
5
+ IterableWritableStream
6
+ };
7
+ //# sourceMappingURL=iter-fest.iterableWritableStream.mjs.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `drop` takes an integer as an argument. It skips the given number of elements produced by the underlying iterator before itself producing any remaining elements.
3
+ *
4
+ * @param limit
5
+ *
6
+ * @return Returns an iterator of items after the limit.
7
+ *
8
+ * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md
9
+ */
10
+ declare function iteratorDrop<T>(iterator: Iterator<T>, limit: number): Iterator<T>;
11
+
12
+ export { iteratorDrop };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `drop` takes an integer as an argument. It skips the given number of elements produced by the underlying iterator before itself producing any remaining elements.
3
+ *
4
+ * @param limit
5
+ *
6
+ * @return Returns an iterator of items after the limit.
7
+ *
8
+ * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md
9
+ */
10
+ declare function iteratorDrop<T>(iterator: Iterator<T>, limit: number): Iterator<T>;
11
+
12
+ export { iteratorDrop };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/iteratorDrop.ts
31
+ var iteratorDrop_exports = {};
32
+ __export(iteratorDrop_exports, {
33
+ iteratorDrop: () => iteratorDrop
34
+ });
35
+ module.exports = __toCommonJS(iteratorDrop_exports);
36
+ var import_drop = __toESM(require("core-js-pure/full/iterator/drop"));
37
+ function iteratorDrop(iterator, limit) {
38
+ return (0, import_drop.default)(iterator, limit);
39
+ }
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ iteratorDrop
43
+ });
44
+ //# sourceMappingURL=iter-fest.iteratorDrop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iteratorDrop.ts"],"sourcesContent":["// @ts-expect-error core-js-pure is not typed.\nimport drop from 'core-js-pure/full/iterator/drop';\n\n/**\n * `drop` takes an integer as an argument. It skips the given number of elements produced by the underlying iterator before itself producing any remaining elements.\n *\n * @param limit\n *\n * @return Returns an iterator of items after the limit.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorDrop<T>(iterator: Iterator<T>, limit: number): Iterator<T> {\n return drop(iterator, limit);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAiB;AAWV,SAAS,aAAgB,UAAuB,OAA4B;AACjF,aAAO,YAAAA,SAAK,UAAU,KAAK;AAC7B;","names":["drop"]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ iteratorDrop
3
+ } from "./chunk-R6SXIXMH.mjs";
4
+ export {
5
+ iteratorDrop
6
+ };
7
+ //# sourceMappingURL=iter-fest.iteratorDrop.mjs.map