iter-fest 0.1.0 → 0.1.1-main.149c8ad
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +225 -19
- package/dist/chunk-2DE3J4J7.mjs +35 -0
- package/dist/chunk-2DE3J4J7.mjs.map +1 -0
- package/dist/chunk-3S6LCGE6.mjs +10 -0
- package/dist/chunk-3S6LCGE6.mjs.map +1 -0
- package/dist/chunk-ANRVAYLW.mjs +35 -0
- package/dist/chunk-ANRVAYLW.mjs.map +1 -0
- package/dist/chunk-BWMXKULC.mjs +46 -0
- package/dist/chunk-BWMXKULC.mjs.map +1 -0
- package/dist/chunk-EIIP7YWB.mjs +27 -0
- package/dist/chunk-EIIP7YWB.mjs.map +1 -0
- package/dist/chunk-EUVK4YM7.mjs +25 -0
- package/dist/chunk-EUVK4YM7.mjs.map +1 -0
- package/dist/chunk-FBST4AUL.mjs +10 -0
- package/dist/chunk-FBST4AUL.mjs.map +1 -0
- package/dist/chunk-FEOLYD5R.mjs +31 -0
- package/dist/chunk-FEOLYD5R.mjs.map +1 -0
- package/dist/chunk-FMIHIL6A.mjs +10 -0
- package/dist/chunk-FMIHIL6A.mjs.map +1 -0
- package/dist/chunk-KYMTQJIJ.mjs +10 -0
- package/dist/chunk-KYMTQJIJ.mjs.map +1 -0
- package/dist/chunk-LIMQXDFK.mjs +10 -0
- package/dist/chunk-LIMQXDFK.mjs.map +1 -0
- package/dist/chunk-OJMT4K3R.mjs +8 -0
- package/dist/chunk-OJMT4K3R.mjs.map +1 -0
- package/dist/chunk-OWUGLCQB.mjs +10 -0
- package/dist/chunk-OWUGLCQB.mjs.map +1 -0
- package/dist/chunk-P4OSZLEH.mjs +15 -0
- package/dist/chunk-P4OSZLEH.mjs.map +1 -0
- package/dist/chunk-QX6EMOSQ.mjs +10 -0
- package/dist/chunk-QX6EMOSQ.mjs.map +1 -0
- package/dist/chunk-R6SXIXMH.mjs +10 -0
- package/dist/chunk-R6SXIXMH.mjs.map +1 -0
- package/dist/chunk-TDHR35S7.mjs +10 -0
- package/dist/chunk-TDHR35S7.mjs.map +1 -0
- package/dist/chunk-VCKLUCOT.mjs +10 -0
- package/dist/chunk-VCKLUCOT.mjs.map +1 -0
- package/dist/chunk-VLF6DI2U.mjs +30 -0
- package/dist/chunk-VLF6DI2U.mjs.map +1 -0
- package/dist/chunk-XQDGXAAF.mjs +10 -0
- package/dist/chunk-XQDGXAAF.mjs.map +1 -0
- package/dist/chunk-YJSIVBF7.mjs +22 -0
- package/dist/chunk-YJSIVBF7.mjs.map +1 -0
- package/dist/chunk-YLERARWI.mjs +10 -0
- package/dist/chunk-YLERARWI.mjs.map +1 -0
- package/dist/iter-fest.asyncGeneratorWithLastValue.d.mts +6 -0
- package/dist/iter-fest.asyncGeneratorWithLastValue.d.ts +6 -0
- package/dist/iter-fest.asyncGeneratorWithLastValue.js +59 -0
- package/dist/iter-fest.asyncGeneratorWithLastValue.js.map +1 -0
- package/dist/iter-fest.asyncGeneratorWithLastValue.mjs +7 -0
- package/dist/iter-fest.asyncIteratorToAsyncIterable.d.mts +3 -0
- package/dist/iter-fest.asyncIteratorToAsyncIterable.d.ts +3 -0
- package/dist/{iter-fest.iterableFind.js → iter-fest.asyncIteratorToAsyncIterable.js} +15 -19
- package/dist/iter-fest.asyncIteratorToAsyncIterable.js.map +1 -0
- package/dist/iter-fest.asyncIteratorToAsyncIterable.mjs +7 -0
- package/dist/iter-fest.d.mts +23 -7
- package/dist/iter-fest.d.ts +23 -7
- package/dist/iter-fest.generatorWithLastValue.d.mts +6 -0
- package/dist/iter-fest.generatorWithLastValue.d.ts +6 -0
- package/dist/iter-fest.generatorWithLastValue.js +59 -0
- package/dist/iter-fest.generatorWithLastValue.js.map +1 -0
- package/dist/iter-fest.generatorWithLastValue.mjs +7 -0
- package/dist/iter-fest.iterableWritableStream.d.mts +7 -0
- package/dist/iter-fest.iterableWritableStream.d.ts +7 -0
- package/dist/iter-fest.iterableWritableStream.js +82 -0
- package/dist/iter-fest.iterableWritableStream.js.map +1 -0
- package/dist/iter-fest.iterableWritableStream.mjs +7 -0
- package/dist/iter-fest.iteratorDrop.d.mts +12 -0
- package/dist/iter-fest.iteratorDrop.d.ts +12 -0
- package/dist/iter-fest.iteratorDrop.js +44 -0
- package/dist/iter-fest.iteratorDrop.js.map +1 -0
- package/dist/iter-fest.iteratorDrop.mjs +7 -0
- package/dist/iter-fest.iteratorEvery.d.mts +25 -0
- package/dist/iter-fest.iteratorEvery.d.ts +25 -0
- package/dist/iter-fest.iteratorEvery.js +44 -0
- package/dist/iter-fest.iteratorEvery.js.map +1 -0
- package/dist/iter-fest.iteratorEvery.mjs +7 -0
- package/dist/iter-fest.iteratorFilter.d.mts +18 -0
- package/dist/iter-fest.iteratorFilter.d.ts +18 -0
- package/dist/iter-fest.iteratorFilter.js +44 -0
- package/dist/iter-fest.iteratorFilter.js.map +1 -0
- package/dist/iter-fest.iteratorFilter.mjs +7 -0
- package/dist/iter-fest.iteratorFind.d.mts +14 -0
- package/dist/iter-fest.iteratorFind.d.ts +14 -0
- package/dist/iter-fest.iteratorFind.js +44 -0
- package/dist/iter-fest.iteratorFind.js.map +1 -0
- package/dist/iter-fest.iteratorFind.mjs +7 -0
- package/dist/iter-fest.iteratorFind.mjs.map +1 -0
- package/dist/iter-fest.iteratorFlatMap.d.mts +12 -0
- package/dist/iter-fest.iteratorFlatMap.d.ts +12 -0
- package/dist/iter-fest.iteratorFlatMap.js +44 -0
- package/dist/iter-fest.iteratorFlatMap.js.map +1 -0
- package/dist/iter-fest.iteratorFlatMap.mjs +7 -0
- package/dist/iter-fest.iteratorFlatMap.mjs.map +1 -0
- package/dist/iter-fest.iteratorForEach.d.mts +10 -0
- package/dist/iter-fest.iteratorForEach.d.ts +10 -0
- package/dist/iter-fest.iteratorForEach.js +44 -0
- package/dist/iter-fest.iteratorForEach.js.map +1 -0
- package/dist/iter-fest.iteratorForEach.mjs +7 -0
- package/dist/iter-fest.iteratorForEach.mjs.map +1 -0
- package/dist/iter-fest.iteratorFrom.d.mts +12 -0
- package/dist/iter-fest.iteratorFrom.d.ts +12 -0
- package/dist/iter-fest.iteratorFrom.js +44 -0
- package/dist/iter-fest.iteratorFrom.js.map +1 -0
- package/dist/iter-fest.iteratorFrom.mjs +7 -0
- package/dist/iter-fest.iteratorFrom.mjs.map +1 -0
- package/dist/iter-fest.iteratorMap.d.mts +10 -0
- package/dist/iter-fest.iteratorMap.d.ts +10 -0
- package/dist/iter-fest.iteratorMap.js +44 -0
- package/dist/iter-fest.iteratorMap.js.map +1 -0
- package/dist/iter-fest.iteratorMap.mjs +7 -0
- package/dist/iter-fest.iteratorMap.mjs.map +1 -0
- package/dist/{iter-fest.iterableReduce.d.mts → iter-fest.iteratorReduce.d.mts} +13 -9
- package/dist/{iter-fest.iterableReduce.d.ts → iter-fest.iteratorReduce.d.ts} +13 -9
- package/dist/iter-fest.iteratorReduce.js +44 -0
- package/dist/iter-fest.iteratorReduce.js.map +1 -0
- package/dist/iter-fest.iteratorReduce.mjs +7 -0
- package/dist/iter-fest.iteratorReduce.mjs.map +1 -0
- package/dist/iter-fest.iteratorSome.d.mts +10 -0
- package/dist/iter-fest.iteratorSome.d.ts +10 -0
- package/dist/iter-fest.iteratorSome.js +44 -0
- package/dist/iter-fest.iteratorSome.js.map +1 -0
- package/dist/iter-fest.iteratorSome.mjs +7 -0
- package/dist/iter-fest.iteratorSome.mjs.map +1 -0
- package/dist/iter-fest.iteratorTake.d.mts +12 -0
- package/dist/iter-fest.iteratorTake.d.ts +12 -0
- package/dist/iter-fest.iteratorTake.js +44 -0
- package/dist/iter-fest.iteratorTake.js.map +1 -0
- package/dist/iter-fest.iteratorTake.mjs +7 -0
- package/dist/iter-fest.iteratorTake.mjs.map +1 -0
- package/dist/iter-fest.iteratorToArray.d.mts +13 -0
- package/dist/iter-fest.iteratorToArray.d.ts +13 -0
- package/dist/iter-fest.iteratorToArray.js +44 -0
- package/dist/iter-fest.iteratorToArray.js.map +1 -0
- package/dist/iter-fest.iteratorToArray.mjs +7 -0
- package/dist/iter-fest.iteratorToArray.mjs.map +1 -0
- package/dist/iter-fest.js +360 -115
- package/dist/iter-fest.js.map +1 -1
- package/dist/iter-fest.mjs +92 -32
- package/dist/iter-fest.observable.d.mts +51 -0
- package/dist/iter-fest.observable.d.ts +51 -0
- package/dist/iter-fest.observable.js +66 -0
- package/dist/iter-fest.observable.js.map +1 -0
- package/dist/iter-fest.observable.mjs +8 -0
- package/dist/iter-fest.observable.mjs.map +1 -0
- package/dist/iter-fest.observableFromAsync.d.mts +7 -0
- package/dist/iter-fest.observableFromAsync.d.ts +7 -0
- package/dist/iter-fest.observableFromAsync.js +91 -0
- package/dist/iter-fest.observableFromAsync.js.map +1 -0
- package/dist/iter-fest.observableFromAsync.mjs +9 -0
- package/dist/iter-fest.observableFromAsync.mjs.map +1 -0
- package/dist/iter-fest.observableSubscribeAsReadable.d.mts +7 -0
- package/dist/iter-fest.observableSubscribeAsReadable.d.ts +7 -0
- package/dist/{iter-fest.iterableSome.js → iter-fest.observableSubscribeAsReadable.js} +26 -18
- package/dist/iter-fest.observableSubscribeAsReadable.js.map +1 -0
- package/dist/iter-fest.observableSubscribeAsReadable.mjs +7 -0
- package/dist/iter-fest.observableSubscribeAsReadable.mjs.map +1 -0
- package/dist/iter-fest.readableStreamFrom.d.mts +3 -0
- package/dist/iter-fest.readableStreamFrom.d.ts +3 -0
- package/dist/{iter-fest.iterableEvery.js → iter-fest.readableStreamFrom.js} +21 -18
- package/dist/iter-fest.readableStreamFrom.js.map +1 -0
- package/dist/iter-fest.readableStreamFrom.mjs +7 -0
- package/dist/iter-fest.readableStreamFrom.mjs.map +1 -0
- package/dist/iter-fest.readerValues.d.mts +3 -0
- package/dist/iter-fest.readerValues.d.ts +3 -0
- package/dist/{iter-fest.iterableFilter.js → iter-fest.readerValues.js} +24 -17
- package/dist/iter-fest.readerValues.js.map +1 -0
- package/dist/iter-fest.readerValues.mjs +7 -0
- package/dist/iter-fest.readerValues.mjs.map +1 -0
- package/dist/iter-fest.symbolObservable.d.mts +3 -0
- package/dist/iter-fest.symbolObservable.d.ts +3 -0
- package/dist/iter-fest.symbolObservable.js +42 -0
- package/dist/iter-fest.symbolObservable.js.map +1 -0
- package/dist/iter-fest.symbolObservable.mjs +7 -0
- package/dist/iter-fest.symbolObservable.mjs.map +1 -0
- package/package.json +236 -82
- package/dist/chunk-5CRMPYKD.mjs +0 -19
- package/dist/chunk-5CRMPYKD.mjs.map +0 -1
- package/dist/chunk-6C3P4TNK.mjs +0 -19
- package/dist/chunk-6C3P4TNK.mjs.map +0 -1
- package/dist/chunk-EZC33HE6.mjs +0 -15
- package/dist/chunk-EZC33HE6.mjs.map +0 -1
- package/dist/chunk-JU353VSE.mjs +0 -16
- package/dist/chunk-JU353VSE.mjs.map +0 -1
- package/dist/chunk-MNLOWKTC.mjs +0 -19
- package/dist/chunk-MNLOWKTC.mjs.map +0 -1
- package/dist/chunk-XW34KZRY.mjs +0 -17
- package/dist/chunk-XW34KZRY.mjs.map +0 -1
- package/dist/chunk-ZUBHGSCW.mjs +0 -18
- package/dist/chunk-ZUBHGSCW.mjs.map +0 -1
- package/dist/iter-fest.iterableEvery.d.mts +0 -24
- package/dist/iter-fest.iterableEvery.d.ts +0 -24
- package/dist/iter-fest.iterableEvery.js.map +0 -1
- package/dist/iter-fest.iterableEvery.mjs +0 -7
- package/dist/iter-fest.iterableFilter.d.mts +0 -16
- package/dist/iter-fest.iterableFilter.d.ts +0 -16
- package/dist/iter-fest.iterableFilter.js.map +0 -1
- package/dist/iter-fest.iterableFilter.mjs +0 -7
- package/dist/iter-fest.iterableFind.d.mts +0 -15
- package/dist/iter-fest.iterableFind.d.ts +0 -15
- package/dist/iter-fest.iterableFind.js.map +0 -1
- package/dist/iter-fest.iterableFind.mjs +0 -7
- package/dist/iter-fest.iterableForEach.d.mts +0 -10
- package/dist/iter-fest.iterableForEach.d.ts +0 -10
- package/dist/iter-fest.iterableForEach.js +0 -40
- package/dist/iter-fest.iterableForEach.js.map +0 -1
- package/dist/iter-fest.iterableForEach.mjs +0 -7
- package/dist/iter-fest.iterableMap.d.mts +0 -8
- package/dist/iter-fest.iterableMap.d.ts +0 -8
- package/dist/iter-fest.iterableMap.js +0 -39
- package/dist/iter-fest.iterableMap.js.map +0 -1
- package/dist/iter-fest.iterableMap.mjs +0 -7
- package/dist/iter-fest.iterableReduce.js +0 -41
- package/dist/iter-fest.iterableReduce.js.map +0 -1
- package/dist/iter-fest.iterableReduce.mjs +0 -7
- package/dist/iter-fest.iterableSome.d.mts +0 -12
- package/dist/iter-fest.iterableSome.d.ts +0 -12
- package/dist/iter-fest.iterableSome.js.map +0 -1
- package/dist/iter-fest.iterableSome.mjs +0 -7
- /package/dist/{iter-fest.iterableEvery.mjs.map → iter-fest.asyncGeneratorWithLastValue.mjs.map} +0 -0
- /package/dist/{iter-fest.iterableFilter.mjs.map → iter-fest.asyncIteratorToAsyncIterable.mjs.map} +0 -0
- /package/dist/{iter-fest.iterableFind.mjs.map → iter-fest.generatorWithLastValue.mjs.map} +0 -0
- /package/dist/{iter-fest.iterableForEach.mjs.map → iter-fest.iterableWritableStream.mjs.map} +0 -0
- /package/dist/{iter-fest.iterableMap.mjs.map → iter-fest.iteratorDrop.mjs.map} +0 -0
- /package/dist/{iter-fest.iterableReduce.mjs.map → iter-fest.iteratorEvery.mjs.map} +0 -0
- /package/dist/{iter-fest.iterableSome.mjs.map → iter-fest.iteratorFilter.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/iteratorEvery.ts"],"sourcesContent":["// @ts-expect-error core-js-pure is not typed.\nimport every from 'core-js-pure/full/iterator/every';\n\n/**\n * Determines whether all the members of an iterator satisfy the specified test.\n *\n * @param predicate A function that accepts up to three arguments. The every method calls\n * the predicate function for each element in the iterator until the predicate returns a value\n * which is coercible to the Boolean value false, or until the end of the iterator.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorEvery<T, S extends T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number) => value is S\n): iterator is Iterator<S>;\n\n/**\n * Determines whether all the members of an iterator satisfy the specified test.\n *\n * @param predicate A function that accepts up to three arguments. The every method calls\n * the predicate function for each element in the iterator until the predicate returns a value\n * which is coercible to the Boolean value false, or until the end of the iterator.\n *\n * @param thisArg An object to which the this keyword can refer in the predicate function.\n * If thisArg is omitted, undefined is used as the this value.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorEvery<T>(iterator: Iterator<T>, predicate: (value: T, index: number) => unknown): boolean;\n\nexport function iteratorEvery<T>(iterator: Iterator<T>, predicate: (value: T, index: number) => unknown): boolean {\n return every(iterator, predicate);\n}\n"],"mappings":";AACA,OAAO,WAAW;AA8BX,SAAS,cAAiB,UAAuB,WAA0D;AAChH,SAAO,MAAM,UAAU,SAAS;AAClC;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/asyncIteratorToAsyncIterable.ts
|
|
2
|
+
function asyncIteratorToAsyncIterable(asyncIterator) {
|
|
3
|
+
const asyncIterableIterator = {
|
|
4
|
+
[Symbol.asyncIterator]: () => asyncIterableIterator,
|
|
5
|
+
next: asyncIterator.next.bind(asyncIterator),
|
|
6
|
+
...asyncIterator.return ? { return: asyncIterator.return.bind(asyncIterator) } : {},
|
|
7
|
+
...asyncIterator.throw ? { throw: asyncIterator.throw.bind(asyncIterator) } : {}
|
|
8
|
+
};
|
|
9
|
+
return asyncIterableIterator;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
asyncIteratorToAsyncIterable
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=chunk-P4OSZLEH.mjs.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":";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 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/iteratorFlatMap.ts"],"sourcesContent":["// @ts-expect-error core-js-pure is not typed.\nimport flatMap from 'core-js-pure/full/iterator/flat-map';\n\n/**\n * `.flatMap` takes a mapping function as an argument. It returns an iterator that produces all elements of the iterators produced by applying the mapping function to the elements produced by the underlying iterator.\n *\n * @param mapperFn\n *\n * @return Returns an iterator of flat values.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorFlatMap<T, U>(iterable: Iterable<T>, mapperFn: (value: T, index: number) => U): Iterator<T> {\n return flatMap(iterable, mapperFn);\n}\n"],"mappings":";AACA,OAAO,aAAa;AAWb,SAAS,gBAAsB,UAAuB,UAAuD;AAClH,SAAO,QAAQ,UAAU,QAAQ;AACnC;","names":[]}
|
|
@@ -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":";AACA,OAAO,UAAU;AAWV,SAAS,aAAgB,UAAuB,OAA4B;AACjF,SAAO,KAAK,UAAU,KAAK;AAC7B;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/iteratorFilter.ts"],"sourcesContent":["// @ts-expect-error core-js-pure is not typed.\nimport filter from 'core-js-pure/full/iterator/filter';\n\n/**\n * Returns the elements of an iterator that meet the condition specified in a callback function.\n *\n * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the iterator.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorFilter<T, S extends T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number) => value is S\n): IterableIterator<S>;\n\n/**\n * Returns the elements of an iterator that meet the condition specified in a callback function.\n *\n * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the iterator.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorFilter<T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number) => unknown\n): IterableIterator<T>;\n\nexport function iteratorFilter<T, S extends T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number) => unknown\n): IterableIterator<S> {\n return filter(iterator, predicate);\n}\n"],"mappings":";AACA,OAAO,YAAY;AA0BZ,SAAS,eACd,UACA,WACqB;AACrB,SAAO,OAAO,UAAU,SAAS;AACnC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/iteratorTake.ts"],"sourcesContent":["// @ts-expect-error core-js-pure is not typed.\nimport take from 'core-js-pure/full/iterator/take';\n\n/**\n * `take` takes an integer as an argument. It returns an iterator that produces, at most, the given number of elements produced by the underlying iterator.\n *\n * @param limit\n *\n * @return Returns an iterator with items from the original iterator from 0 until the limit.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorTake<T>(iterator: Iterator<T>, limit: number): Iterator<T> {\n return take(iterator, limit);\n}\n"],"mappings":";AACA,OAAO,UAAU;AAWV,SAAS,aAAgB,UAAuB,OAA4B;AACjF,SAAO,KAAK,UAAU,KAAK;AAC7B;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SymbolObservable
|
|
3
|
+
} from "./chunk-OJMT4K3R.mjs";
|
|
4
|
+
|
|
5
|
+
// src/Observable.ts
|
|
6
|
+
import CoreJSObservable from "core-js-pure/full/observable";
|
|
7
|
+
var Observable = class extends CoreJSObservable {
|
|
8
|
+
constructor(subscriber) {
|
|
9
|
+
super(subscriber);
|
|
10
|
+
}
|
|
11
|
+
subscribe(observerOrOnNext, onError, onComplete) {
|
|
12
|
+
return super.subscribe(observerOrOnNext, onError, onComplete);
|
|
13
|
+
}
|
|
14
|
+
/** Returns itself */
|
|
15
|
+
[SymbolObservable]() {
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
/** Converts items to an Observable */
|
|
19
|
+
static of(...items) {
|
|
20
|
+
return CoreJSObservable.of(...items);
|
|
21
|
+
}
|
|
22
|
+
static from(iterableOrObservable) {
|
|
23
|
+
return CoreJSObservable.from(iterableOrObservable);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
Observable
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=chunk-VLF6DI2U.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Observable.ts"],"sourcesContent":["// @ts-expect-error core-js is not typed.\nimport CoreJSObservable from 'core-js-pure/full/observable';\n\nimport { SymbolObservable } from './SymbolObservable';\n\nexport interface SubscriptionObserver<T> {\n /** Sends the next value in the sequence */\n next(value: T): void;\n\n /** Sends the sequence error */\n error(errorValue: unknown): void;\n\n /** Sends the completion notification */\n complete(): void;\n\n /** A boolean value indicating whether the subscription is closed */\n get closed(): boolean;\n}\n\nexport interface Subscription {\n /** Cancels the subscription */\n unsubscribe(): void;\n\n /** A boolean value indicating whether the subscription is closed */\n get closed(): boolean;\n}\n\nexport type SubscriberFunction<T> = (observer: SubscriptionObserver<T>) => (() => void) | Subscription | void;\n\nexport type CompleteFunction = () => void;\nexport type ErrorFunction = (errorValue: unknown) => void;\nexport type NextFunction<T> = (value: T) => void;\nexport type StartFunction = (subscription: Subscription) => void;\n\nexport interface Observer<T> {\n /** Receives a completion notification */\n complete?(): void;\n\n /** Receives the sequence error */\n error?(errorValue: unknown): void;\n\n /** Receives the next value in the sequence */\n next?(value: T): void;\n\n /** Receives the subscription object when `subscribe` is called */\n start?(subscription: Subscription): void;\n}\n\nexport class Observable<T> extends CoreJSObservable {\n constructor(subscriber: SubscriberFunction<T>) {\n super(subscriber);\n }\n\n /** Subscribes to the sequence with an observer */\n subscribe(observer: Observer<T>): Subscription;\n\n /** Subscribes to the sequence with callbacks */\n subscribe(\n onNext: NextFunction<T>,\n onError?: ErrorFunction | undefined,\n onComplete?: CompleteFunction | undefined\n ): Subscription;\n\n subscribe(\n observerOrOnNext: Observer<T> | NextFunction<T>,\n onError?: ErrorFunction | undefined,\n onComplete?: CompleteFunction | undefined\n ): Subscription {\n return super.subscribe(observerOrOnNext, onError, onComplete);\n }\n\n /** Returns itself */\n [SymbolObservable](): Observable<T> {\n return this;\n }\n\n /** Converts items to an Observable */\n static of<T>(...items: T[]): Observable<T> {\n return CoreJSObservable.of(...items);\n }\n\n /** Converts an iterable to an Observable */\n static from<T>(iterable: Iterable<T>): Observable<T>;\n\n /** Converts an observable to an Observable */\n static from<T>(observable: Observable<T>): Observable<T>;\n\n static from<T>(iterableOrObservable: Iterable<T> | Observable<T>): Observable<T> {\n return CoreJSObservable.from(iterableOrObservable);\n }\n}\n"],"mappings":";;;;;AACA,OAAO,sBAAsB;AA+CtB,IAAM,aAAN,cAA4B,iBAAiB;AAAA,EAClD,YAAY,YAAmC;AAC7C,UAAM,UAAU;AAAA,EAClB;AAAA,EAYA,UACE,kBACA,SACA,YACc;AACd,WAAO,MAAM,UAAU,kBAAkB,SAAS,UAAU;AAAA,EAC9D;AAAA;AAAA,EAGA,CAAC,gBAAgB,IAAmB;AAClC,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,OAAO,MAAS,OAA2B;AACzC,WAAO,iBAAiB,GAAG,GAAG,KAAK;AAAA,EACrC;AAAA,EAQA,OAAO,KAAQ,sBAAkE;AAC/E,WAAO,iBAAiB,KAAK,oBAAoB;AAAA,EACnD;AACF;","names":[]}
|
|
@@ -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":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/readableStreamFrom.ts
|
|
2
|
+
function isIterable(iterable) {
|
|
3
|
+
return !!(iterable && typeof iterable === "object" && Symbol.iterator in iterable);
|
|
4
|
+
}
|
|
5
|
+
function readableStreamFrom(anyIterable) {
|
|
6
|
+
const iterator = isIterable(anyIterable) ? anyIterable[Symbol.iterator]() : anyIterable[Symbol.asyncIterator]();
|
|
7
|
+
return new ReadableStream({
|
|
8
|
+
async pull(controller) {
|
|
9
|
+
const result = await iterator.next();
|
|
10
|
+
if (result.done) {
|
|
11
|
+
controller.close();
|
|
12
|
+
} else {
|
|
13
|
+
controller.enqueue(result.value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
readableStreamFrom
|
|
21
|
+
};
|
|
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 @@
|
|
|
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"]}
|
|
@@ -17,27 +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/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
20
|
+
// src/asyncIteratorToAsyncIterable.ts
|
|
21
|
+
var asyncIteratorToAsyncIterable_exports = {};
|
|
22
|
+
__export(asyncIteratorToAsyncIterable_exports, {
|
|
23
|
+
asyncIteratorToAsyncIterable: () => asyncIteratorToAsyncIterable
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return void 0;
|
|
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;
|
|
38
34
|
}
|
|
39
35
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
36
|
0 && (module.exports = {
|
|
41
|
-
|
|
37
|
+
asyncIteratorToAsyncIterable
|
|
42
38
|
});
|
|
43
|
-
//# sourceMappingURL=iter-fest.
|
|
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":[]}
|
package/dist/iter-fest.d.mts
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
|
+
export { CompleteFunction, ErrorFunction, NextFunction, Observable, Observer, StartFunction, SubscriberFunction, Subscription, SubscriptionObserver } from './iter-fest.observable.mjs';
|
|
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';
|
|
1
6
|
export { iterableAt } from './iter-fest.iterableAt.mjs';
|
|
2
7
|
export { iterableConcat } from './iter-fest.iterableConcat.mjs';
|
|
3
8
|
export { iterableEntries } from './iter-fest.iterableEntries.mjs';
|
|
4
|
-
export { iterableEvery } from './iter-fest.iterableEvery.mjs';
|
|
5
|
-
export { iterableFilter } from './iter-fest.iterableFilter.mjs';
|
|
6
|
-
export { iterableFind } from './iter-fest.iterableFind.mjs';
|
|
7
9
|
export { iterableFindIndex } from './iter-fest.iterableFindIndex.mjs';
|
|
8
10
|
export { iterableFindLast } from './iter-fest.iterableFindLast.mjs';
|
|
9
11
|
export { iterableFindLastIndex } from './iter-fest.iterableFindLastIndex.mjs';
|
|
10
|
-
export { iterableForEach } from './iter-fest.iterableForEach.mjs';
|
|
11
12
|
export { iterableIncludes } from './iter-fest.iterableIncludes.mjs';
|
|
12
13
|
export { iterableIndexOf } from './iter-fest.iterableIndexOf.mjs';
|
|
13
14
|
export { iterableJoin } from './iter-fest.iterableJoin.mjs';
|
|
14
15
|
export { iterableKeys } from './iter-fest.iterableKeys.mjs';
|
|
15
|
-
export { iterableMap } from './iter-fest.iterableMap.mjs';
|
|
16
|
-
export { iterableReduce } from './iter-fest.iterableReduce.mjs';
|
|
17
16
|
export { iterableSlice } from './iter-fest.iterableSlice.mjs';
|
|
18
|
-
export { iterableSome } from './iter-fest.iterableSome.mjs';
|
|
19
17
|
export { iterableToSpliced } from './iter-fest.iterableToSpliced.mjs';
|
|
20
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';
|
|
21
32
|
export { iteratorToIterable } from './iter-fest.iteratorToIterable.mjs';
|
|
33
|
+
export { observableFromAsync } from './iter-fest.observableFromAsync.mjs';
|
|
34
|
+
export { observableSubscribeAsReadable } from './iter-fest.observableSubscribeAsReadable.mjs';
|
|
35
|
+
export { readableStreamFrom } from './iter-fest.readableStreamFrom.mjs';
|
|
36
|
+
export { readerValues } from './iter-fest.readerValues.mjs';
|
|
37
|
+
import 'core-js-pure/full/observable';
|
package/dist/iter-fest.d.ts
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
|
+
export { CompleteFunction, ErrorFunction, NextFunction, Observable, Observer, StartFunction, SubscriberFunction, Subscription, SubscriptionObserver } from './iter-fest.observable.js';
|
|
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';
|
|
1
6
|
export { iterableAt } from './iter-fest.iterableAt.js';
|
|
2
7
|
export { iterableConcat } from './iter-fest.iterableConcat.js';
|
|
3
8
|
export { iterableEntries } from './iter-fest.iterableEntries.js';
|
|
4
|
-
export { iterableEvery } from './iter-fest.iterableEvery.js';
|
|
5
|
-
export { iterableFilter } from './iter-fest.iterableFilter.js';
|
|
6
|
-
export { iterableFind } from './iter-fest.iterableFind.js';
|
|
7
9
|
export { iterableFindIndex } from './iter-fest.iterableFindIndex.js';
|
|
8
10
|
export { iterableFindLast } from './iter-fest.iterableFindLast.js';
|
|
9
11
|
export { iterableFindLastIndex } from './iter-fest.iterableFindLastIndex.js';
|
|
10
|
-
export { iterableForEach } from './iter-fest.iterableForEach.js';
|
|
11
12
|
export { iterableIncludes } from './iter-fest.iterableIncludes.js';
|
|
12
13
|
export { iterableIndexOf } from './iter-fest.iterableIndexOf.js';
|
|
13
14
|
export { iterableJoin } from './iter-fest.iterableJoin.js';
|
|
14
15
|
export { iterableKeys } from './iter-fest.iterableKeys.js';
|
|
15
|
-
export { iterableMap } from './iter-fest.iterableMap.js';
|
|
16
|
-
export { iterableReduce } from './iter-fest.iterableReduce.js';
|
|
17
16
|
export { iterableSlice } from './iter-fest.iterableSlice.js';
|
|
18
|
-
export { iterableSome } from './iter-fest.iterableSome.js';
|
|
19
17
|
export { iterableToSpliced } from './iter-fest.iterableToSpliced.js';
|
|
20
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';
|
|
21
32
|
export { iteratorToIterable } from './iter-fest.iteratorToIterable.js';
|
|
33
|
+
export { observableFromAsync } from './iter-fest.observableFromAsync.js';
|
|
34
|
+
export { observableSubscribeAsReadable } from './iter-fest.observableSubscribeAsReadable.js';
|
|
35
|
+
export { readableStreamFrom } from './iter-fest.readableStreamFrom.js';
|
|
36
|
+
export { readerValues } from './iter-fest.readerValues.js';
|
|
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"]}
|