iter-fest 0.2.2-main.fdb3230 → 0.3.1-main.8cda255
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 +47 -32
- package/dist/chunk-4P4GJT2O.mjs +195 -0
- package/dist/chunk-4P4GJT2O.mjs.map +1 -0
- package/dist/chunk-6ZEIOTH6.mjs +9 -0
- package/dist/chunk-6ZEIOTH6.mjs.map +1 -0
- package/dist/{chunk-2DE3J4J7.mjs → chunk-AMBNMMKA.mjs} +2 -1
- package/dist/chunk-AMBNMMKA.mjs.map +1 -0
- package/dist/{chunk-ANRVAYLW.mjs → chunk-P6MH6RRG.mjs} +2 -1
- package/dist/chunk-P6MH6RRG.mjs.map +1 -0
- package/dist/chunk-YGRCFTJT.mjs +13 -0
- package/dist/chunk-YGRCFTJT.mjs.map +1 -0
- package/dist/iter-fest.asyncGeneratorWithLastValue.js +1 -0
- package/dist/iter-fest.asyncGeneratorWithLastValue.js.map +1 -1
- package/dist/iter-fest.asyncGeneratorWithLastValue.mjs +1 -1
- package/dist/iter-fest.d.mts +1 -0
- package/dist/iter-fest.d.ts +1 -0
- package/dist/iter-fest.generatorWithLastValue.js +1 -0
- package/dist/iter-fest.generatorWithLastValue.js.map +1 -1
- package/dist/iter-fest.generatorWithLastValue.mjs +1 -1
- package/dist/iter-fest.js +203 -47
- package/dist/iter-fest.js.map +1 -1
- package/dist/iter-fest.mjs +11 -7
- package/dist/iter-fest.observableValues.js +1 -45
- package/dist/iter-fest.observableValues.js.map +1 -1
- package/dist/iter-fest.observableValues.mjs +1 -2
- package/dist/iter-fest.readableStreamValues.d.mts +6 -1
- package/dist/iter-fest.readableStreamValues.d.ts +6 -1
- package/dist/iter-fest.readableStreamValues.js +2 -19
- package/dist/iter-fest.readableStreamValues.js.map +1 -1
- package/dist/iter-fest.readableStreamValues.mjs +1 -1
- package/dist/iter-fest.readableStreamValuesWithSignal.d.mts +15 -0
- package/dist/iter-fest.readableStreamValuesWithSignal.d.ts +15 -0
- package/dist/iter-fest.readableStreamValuesWithSignal.js +221 -0
- package/dist/iter-fest.readableStreamValuesWithSignal.js.map +1 -0
- package/dist/iter-fest.readableStreamValuesWithSignal.mjs +7 -0
- package/dist/iter-fest.readableStreamValuesWithSignal.mjs.map +1 -0
- package/package.json +23 -13
- package/dist/chunk-2DE3J4J7.mjs.map +0 -1
- package/dist/chunk-ANRVAYLW.mjs.map +0 -1
- package/dist/chunk-RVIERPEV.mjs +0 -26
- package/dist/chunk-RVIERPEV.mjs.map +0 -1
- package/dist/chunk-WMTE2GGJ.mjs +0 -38
- package/dist/chunk-WMTE2GGJ.mjs.map +0 -1
package/dist/iter-fest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/Observable.ts","../src/SymbolObservable.ts","../src/asyncGeneratorWithLastValue.ts","../src/asyncIteratorDrop.ts","../src/asyncIteratorEvery.ts","../src/asyncIteratorFilter.ts","../src/asyncIteratorFind.ts","../src/asyncIteratorFlatMap.ts","../src/asyncIteratorForEach.ts","../src/asyncIteratorFrom.ts","../src/asyncIteratorMap.ts","../src/asyncIteratorReduce.ts","../src/asyncIteratorSome.ts","../src/asyncIteratorTake.ts","../src/asyncIteratorToArray.ts","../src/asyncIteratorToAsyncIterable.ts","../src/generatorWithLastValue.ts","../src/private/withResolvers.ts","../src/iterableWritableStream.ts","../src/iteratorToIterable.ts","../src/private/toIntegerOrInfinity.ts","../src/iteratorAt.ts","../src/iteratorConcat.ts","../src/iteratorDrop.ts","../src/iteratorEntries.ts","../src/iteratorEvery.ts","../src/iteratorFilter.ts","../src/iteratorFind.ts","../src/iteratorFindIndex.ts","../src/iteratorFindLast.ts","../src/iteratorFindLastIndex.ts","../src/iteratorFlatMap.ts","../src/iteratorForEach.ts","../src/iteratorFrom.ts","../src/iteratorIncludes.ts","../src/iteratorIndexOf.ts","../src/iteratorJoin.ts","../src/iteratorKeys.ts","../src/iteratorMap.ts","../src/iteratorReduce.ts","../src/iteratorSlice.ts","../src/iteratorSome.ts","../src/iteratorTake.ts","../src/iteratorToArray.ts","../src/iteratorToAsync.ts","../src/iteratorToSpliced.ts","../src/iteratorToString.ts","../src/observableFromAsync.ts","../src/observableSubscribeAsReadable.ts","../src/readableStreamValues.ts","../src/observableValues.ts","../src/readableStreamFrom.ts"],"sourcesContent":["export * from './Observable.ts';\nexport * from './SymbolObservable.ts';\nexport * from './asyncGeneratorWithLastValue.ts';\nexport * from './asyncIteratorDrop.ts';\nexport * from './asyncIteratorEvery.ts';\nexport * from './asyncIteratorFilter.ts';\nexport * from './asyncIteratorFind.ts';\nexport * from './asyncIteratorFlatMap.ts';\nexport * from './asyncIteratorForEach.ts';\nexport * from './asyncIteratorFrom.ts';\nexport * from './asyncIteratorMap.ts';\nexport * from './asyncIteratorReduce.ts';\nexport * from './asyncIteratorSome.ts';\nexport * from './asyncIteratorTake.ts';\nexport * from './asyncIteratorToArray.ts';\nexport * from './asyncIteratorToAsyncIterable.ts';\nexport * from './generatorWithLastValue.ts';\nexport * from './iterableWritableStream.ts';\nexport * from './iteratorAt.ts';\nexport * from './iteratorConcat.ts';\nexport * from './iteratorDrop.ts';\nexport * from './iteratorEntries.ts';\nexport * from './iteratorEvery.ts';\nexport * from './iteratorFilter.ts';\nexport * from './iteratorFind.ts';\nexport * from './iteratorFindIndex.ts';\nexport * from './iteratorFindLast.ts';\nexport * from './iteratorFindLastIndex.ts';\nexport * from './iteratorFlatMap.ts';\nexport * from './iteratorForEach.ts';\nexport * from './iteratorFrom.ts';\nexport * from './iteratorIncludes.ts';\nexport * from './iteratorIndexOf.ts';\nexport * from './iteratorJoin.ts';\nexport * from './iteratorKeys.ts';\nexport * from './iteratorMap.ts';\nexport * from './iteratorReduce.ts';\nexport * from './iteratorSlice.ts';\nexport * from './iteratorSome.ts';\nexport * from './iteratorTake.ts';\nexport * from './iteratorToArray.ts';\nexport * from './iteratorToAsync.ts';\nexport * from './iteratorToIterable.ts';\nexport * from './iteratorToSpliced.ts';\nexport * from './iteratorToString.ts';\nexport * from './observableFromAsync.ts';\nexport * from './observableSubscribeAsReadable.ts';\nexport * from './observableValues.ts';\nexport * from './readableStreamFrom.ts';\nexport * from './readableStreamValues.ts';\n","// @ts-expect-error core-js is not typed.\nimport CoreJSObservable from 'core-js-pure/full/observable/index.js';\n\nimport { SymbolObservable } from './SymbolObservable.ts';\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","// @ts-expect-error core-js is not typed.\nimport CoreJSSymbolObservable from 'core-js-pure/features/symbol/observable.js';\n\nconst SymbolObservable: unique symbol = CoreJSSymbolObservable;\n\nexport { SymbolObservable };\n","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","// @ts-expect-error core-js-pure is not typed.\nimport drop from 'core-js-pure/full/async-iterator/drop.js';\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 asyncIteratorDrop<T>(asyncIterator: AsyncIterator<T>, limit: number): AsyncIterator<T> {\n return drop(asyncIterator, limit);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport every from 'core-js-pure/full/async-iterator/every.js';\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 asyncIteratorEvery<T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<boolean>\n): Promise<boolean>;\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 asyncIteratorEvery<T>(\n iterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<unknown>\n): Promise<boolean>;\n\nexport function asyncIteratorEvery<T>(\n iterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<unknown>\n): Promise<boolean> {\n return every(iterator, predicate);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport filter from 'core-js-pure/full/async-iterator/filter.js';\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 asyncIteratorFilter<T, S extends T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => value is S\n): AsyncIterableIterator<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 asyncIteratorFilter<T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => unknown\n): AsyncIterableIterator<T>;\n\nexport function asyncIteratorFilter<T, S extends T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => unknown\n): AsyncIterableIterator<S> {\n return filter(asyncIterator, predicate);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport find from 'core-js-pure/full/async-iterator/find.js';\n\n/**\n * Returns the value of the first element in the iterator where predicate is true, and undefined\n * otherwise.\n *\n * @param predicate find calls predicate once for each element of the iterator, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function asyncIteratorFind<T, S extends T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<boolean>\n): Promise<S | undefined>;\n\nexport function asyncIteratorFind<T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<unknown>\n): Promise<T | undefined>;\n\nexport function asyncIteratorFind<T, S extends T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<unknown>\n): Promise<S | undefined> {\n return find(asyncIterator, predicate);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport flatMap from 'core-js-pure/full/async-iterator/flat-map.js';\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 asyncIteratorFlatMap<T, U>(\n asyncIterator: AsyncIterator<T>,\n mapperFn: (value: T, index: number) => Promise<U>\n): AsyncIterator<T> {\n return flatMap(asyncIterator, mapperFn);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport forEach from 'core-js-pure/full/async-iterator/for-each.js';\n\n/**\n * Performs the specified action for each element in an iterator.\n *\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn 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 asyncIteratorForEach<T>(\n asyncIterator: AsyncIterator<T>,\n callbackfn: (value: T, index: number) => Promise<void>\n): Promise<void> {\n return forEach(asyncIterator, callbackfn);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport from from 'core-js-pure/full/async-iterator/from.js';\n\n/**\n * `.from` is a static method (unlike the others listed above) which takes an object as an argument. This method allows wrapping \"iterator-like\" objects with an iterator.\n *\n * @return Returns the object if it is already an iterator, returns a wrapping iterator if the passed object implements a callable @@iterator property.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function asyncIteratorFrom<T>(asyncIteratorLike: Pick<AsyncIterator<T>, 'next'>): AsyncIterator<T> {\n return from(asyncIteratorLike);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport map from 'core-js-pure/full/async-iterator/map.js';\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 asyncIteratorMap<T, U>(\n asyncIterator: AsyncIterator<T>,\n callbackfn: (value: T, index: number) => U\n): AsyncIterableIterator<U> {\n return map(asyncIterator, callbackfn);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport reduce from 'core-js-pure/full/async-iterator/reduce.js';\n\n/**\n * Calls the specified callback function for all the elements in an iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n *\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the iterator.\n *\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an iterator value.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function asyncIteratorReduce<T>(\n asyncIterator: AsyncIterator<T>,\n callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => Promise<T>\n): Promise<T>;\n\nexport function asyncIteratorReduce<T>(\n asyncIterator: AsyncIterator<T>,\n callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => Promise<T>,\n initialValue: T\n): T;\n\n/**\n * Calls the specified callback function for all the elements in an iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n *\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the iterator.\n *\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function asyncIteratorReduce<T, U>(\n asyncIterator: AsyncIterator<T>,\n callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => Promise<U>,\n initialValue: U\n): U;\n\nexport function asyncIteratorReduce<T, U = undefined>(\n asyncIterator: AsyncIterator<T>,\n callbackfn: (previousValue: U | undefined, currentValue: T, currentIndex: number) => Promise<U>,\n initialValue?: U\n): Promise<U | undefined> {\n return reduce(asyncIterator, callbackfn, initialValue);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport some from 'core-js-pure/full/async-iterator/some.js';\n\n/**\n * Determines whether the specified callback function returns true for any element of an iterable.\n *\n * @param predicate A function that accepts up to three arguments. The some method calls the predicate function for each element in the iterable until the predicate returns a value which is coercible to the Boolean value true, or until the end of the iterable.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function asyncIteratorSome<T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<unknown>\n): Promise<boolean> {\n return some(asyncIterator, predicate);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport take from 'core-js-pure/full/async-iterator/take.js';\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 asyncIteratorTake<T>(asyncIterator: AsyncIterator<T>, limit: number): AsyncIterator<T> {\n return take(asyncIterator, limit);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport toArray from 'core-js-pure/full/async-iterator/to-array.js';\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 * @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 asyncIteratorToArray<T>(asyncIteratorLike: Pick<AsyncIterator<T>, 'next'>): Promise<T[]> {\n return toArray(asyncIteratorLike);\n}\n","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","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","// @ts-expect-error \"core-js\" is not typed.\nimport coreJSPromiseWithResolvers from 'core-js-pure/full/promise/with-resolvers.js';\n\nexport default function withResolvers<T>(): PromiseWithResolvers<T> {\n return coreJSPromiseWithResolvers();\n}\n","import withResolvers from './private/withResolvers.ts';\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","export function iteratorToIterable<T>(iterator: Iterator<T>): IterableIterator<T> {\n const iterableIterator: IterableIterator<T> = {\n [Symbol.iterator]: () => iterableIterator,\n next: iterator.next.bind(iterator),\n ...(iterator.return ? { return: iterator.return.bind(iterator) } : {}),\n ...(iterator.throw ? { throw: iterator.throw.bind(iterator) } : {})\n };\n\n return iterableIterator;\n}\n","export default function toIntegerOrInfinity(value: number): number {\n if (value === Infinity || value === -Infinity) {\n return value;\n }\n\n return ~~value;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\nimport toIntegerOrInfinity from './private/toIntegerOrInfinity.ts';\n\n/**\n * Returns the item located at the specified index.\n *\n * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.\n */\nexport function iteratorAt<T>(iterator: Iterator<T>, index: number): T | undefined {\n let currentIndex = 0;\n\n index = toIntegerOrInfinity(index);\n\n if (!isFinite(index)) {\n return;\n }\n\n if (index < 0) {\n throw new TypeError('index cannot be a negative finite number');\n }\n\n for (const value of iteratorToIterable(iterator)) {\n if (currentIndex++ === index) {\n return value;\n }\n }\n\n return undefined;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\n\nfunction isIterator<T>(value: unknown): value is Iterator<T> {\n return !!value && typeof value === 'object' && Symbol.iterator in value;\n}\n\n/**\n * Combines two or more iterators.\n * This method returns a new iterator without modifying any existing iterators.\n *\n * @param items Additional iterators and/or items to add to the end of the iterator.\n */\nexport function iteratorConcat<T>(iterator: Iterator<T>, ...items: Iterator<T>[]): IterableIterator<T>;\n\n/**\n * Combines two or more iterators.\n * This method returns a new iterator without modifying any existing iterators.\n *\n * @param items Additional iterators and/or items to add to the end of the iterator.\n */\nexport function iteratorConcat<T>(iterator: Iterator<T>, ...items: (T | Iterator<T>)[]): IterableIterator<T>;\n\nexport function* iteratorConcat<T>(iterator: Iterator<T>, ...items: (T | Iterator<T>)[]): IterableIterator<T> {\n yield* iteratorToIterable(iterator);\n\n for (const item of items) {\n if (isIterator(item)) {\n yield* iteratorToIterable(item);\n } else {\n yield item;\n }\n }\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport drop from 'core-js-pure/full/iterator/drop.js';\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","import { iteratorToIterable } from './iteratorToIterable.ts';\n\n/**\n * Returns an iterator of key, value pairs for every entry in the iterator\n */\nexport function* iteratorEntries<T>(iterator: Iterator<T>): IterableIterator<[number, T]> {\n let index = 0;\n\n for (const value of iteratorToIterable(iterator)) {\n yield [index++, value];\n }\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport every from 'core-js-pure/full/iterator/every.js';\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","// @ts-expect-error core-js-pure is not typed.\nimport filter from 'core-js-pure/full/iterator/filter.js';\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","// @ts-expect-error core-js-pure is not typed.\nimport find from 'core-js-pure/full/iterator/find.js';\n\n/**\n * Returns the value of the first element in the iterator where predicate is true, and undefined\n * otherwise.\n *\n * @param predicate find calls predicate once for each element of the iterator, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorFind<T, S extends T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number) => value is S\n): S | undefined;\n\nexport function iteratorFind<T>(iterator: Iterator<T>, predicate: (value: T, index: number) => unknown): T | undefined;\n\nexport function iteratorFind<T, S extends T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number) => unknown\n): S | undefined {\n return find(iterator, predicate);\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\n\n/**\n * Returns the index of the first element in the iterator where predicate is true, and -1\n * otherwise.\n *\n * @param predicate find calls predicate once for each element of the iterator, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iteratorFindIndex<T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number, obj: Iterator<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): number {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iteratorToIterable(iterator)) {\n if (boundPredicate(value, index, iterator)) {\n return index;\n }\n\n index++;\n }\n\n return -1;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\n\n/**\n * Returns the value of the last element in the iterator where predicate is true, and undefined\n * otherwise.\n *\n * @param predicate findLast calls predicate once for each element of the iterator, in descending\n * order, until it finds one where predicate returns true. If such an element is found, findLast\n * immediately returns that element value. Otherwise, findLast returns undefined.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iteratorFindLast<T, S extends T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number, iterator: Iterator<T>) => value is S,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): S | undefined;\n\nexport function iteratorFindLast<T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number, iterator: Iterator<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): T | undefined;\n\nexport function iteratorFindLast<T, S extends T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number, iterator: Iterator<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): S | undefined {\n let index = 0;\n let last: S | undefined;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iteratorToIterable(iterator)) {\n if (boundPredicate(value, index++, iterator)) {\n last = value as S;\n }\n }\n\n return last;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\n\n/**\n * Returns the index of the last element in the iterator where predicate is true, and -1\n * otherwise.\n *\n * @param predicate findLastIndex calls predicate once for each element of the iterator, in descending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iteratorFindLastIndex<T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number, iterator: Iterator<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): number {\n let index = 0;\n let lastIndex: number = -1;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iteratorToIterable(iterator)) {\n if (boundPredicate(value, index, iterator)) {\n lastIndex = index;\n }\n\n index++;\n }\n\n return lastIndex;\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport flatMap from 'core-js-pure/full/iterator/flat-map.js';\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>(iterator: Iterator<T>, mapperFn: (value: T, index: number) => U): Iterator<T> {\n return flatMap(iterator, mapperFn);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport forEach from 'core-js-pure/full/iterator/for-each.js';\n\n/**\n * Performs the specified action for each element in an iterator.\n *\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn 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 iteratorForEach<T>(iterator: Iterator<T>, callbackfn: (value: T, index: number) => void): void {\n forEach(iterator, callbackfn);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport from from 'core-js-pure/full/iterator/from.js';\n\n/**\n * `.from` is a static method (unlike the others listed above) which takes an object as an argument. This method allows wrapping \"iterator-like\" objects with an iterator.\n *\n * @return Returns the object if it is already an iterator, returns a wrapping iterator if the passed object implements a callable @@iterator property.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorFrom<T>(iteratorLike: Pick<Iterator<T>, 'next'>): Iterator<T> {\n return from(iteratorLike);\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\nimport toIntegerOrInfinity from './private/toIntegerOrInfinity.ts';\n\n/**\n * Determines whether an iterator includes a certain element, returning true or false as appropriate.\n *\n * @param searchElement The element to search for.\n * @param fromIndex The position in this iterator at which to begin searching for searchElement.\n */\nexport function iteratorIncludes<T>(iterator: Iterator<T>, searchElement: T, fromIndex: number = 0): boolean {\n let index = 0;\n\n fromIndex = toIntegerOrInfinity(fromIndex);\n\n if (fromIndex !== Infinity) {\n fromIndex = fromIndex === -Infinity ? 0 : fromIndex;\n\n if (fromIndex < 0) {\n // TODO: Support negative fromIndex.\n throw new TypeError('fromIndex cannot be a negative finite number');\n }\n\n for (const item of iteratorToIterable(iterator)) {\n if (index++ >= fromIndex && Object.is(item, searchElement)) {\n return true;\n }\n }\n }\n\n return false;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\nimport toIntegerOrInfinity from './private/toIntegerOrInfinity.ts';\n\n/**\n * Returns the index of the first occurrence of a value in an iterator, or -1 if it is not present.\n *\n * @param searchElement The value to locate in the iterator.\n * @param fromIndex The iterator index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\nexport function iteratorIndexOf<T>(iterator: Iterator<T>, searchElement: T, fromIndex: number = 0): number {\n let index = 0;\n\n fromIndex = toIntegerOrInfinity(fromIndex);\n\n if (fromIndex !== Infinity) {\n fromIndex = fromIndex === -Infinity ? 0 : fromIndex;\n\n if (fromIndex < 0) {\n // TODO: Support negative fromIndex.\n throw new TypeError('fromIndex cannot be a negative finite number');\n }\n\n for (const item of iteratorToIterable(iterator)) {\n if (index >= fromIndex && Object.is(item, searchElement)) {\n return index;\n }\n\n index++;\n }\n }\n\n return -1;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\n\n/**\n * Adds all the elements of an iterator into a string, separated by the specified separator string.\n *\n * @param separator A string used to separate one element of the iterator from the next in the resulting string. If omitted, the iterator elements are separated with a comma.\n */\nexport function iteratorJoin<T>(iterator: Iterator<T>, separator: string = ','): string {\n let index = 0;\n let result = '';\n\n for (const item of iteratorToIterable(iterator)) {\n if (index) {\n result += separator;\n }\n\n if (typeof item !== 'undefined' && item !== null) {\n result += item;\n }\n\n index++;\n }\n\n return result;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\n\n/**\n * Returns an iterator of keys in the iterator\n */\nexport function* iteratorKeys<T>(iterator: Iterator<T>): IterableIterator<number> {\n let index = 0;\n\n for (const _ of iteratorToIterable(iterator)) {\n yield index++;\n }\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport map from 'core-js-pure/full/iterator/map.js';\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","// @ts-expect-error core-js-pure is not typed.\nimport reduce from 'core-js-pure/full/iterator/reduce.js';\n\n/**\n * Calls the specified callback function for all the elements in an iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n *\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the iterator.\n *\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an iterator value.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorReduce<T>(\n iterator: Iterator<T>,\n callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T\n): T;\n\nexport function iteratorReduce<T>(\n iterator: Iterator<T>,\n callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T,\n initialValue: T\n): T;\n\n/**\n * Calls the specified callback function for all the elements in an iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n *\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the iterator.\n *\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorReduce<T, U>(\n iterator: Iterator<T>,\n callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U,\n initialValue: U\n): U;\n\nexport function iteratorReduce<T, U = undefined>(\n iterator: Iterator<T>,\n callbackfn: (previousValue: U | undefined, currentValue: T, currentIndex: number) => U,\n initialValue?: U\n): U | undefined {\n return reduce(iterator, callbackfn, initialValue);\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\nimport toIntegerOrInfinity from './private/toIntegerOrInfinity.ts';\n\n/**\n * Returns a copy of a section of an iterator.\n * For both start and end, a negative index can be used to indicate an offset from the end of the iterator.\n * For example, -2 refers to the second to last element of the iterator.\n *\n * @param start The beginning index of the specified portion of the iterator.\n * If start is undefined, then the slice begins at index 0.\n *\n * @param end The end index of the specified portion of the iterator. This is exclusive of the element at the index 'end'.\n * If end is undefined, then the slice extends to the end of the iterator.\n */\nexport function* iteratorSlice<T>(\n iterator: Iterator<T>,\n start: number = 0,\n end: number = Infinity\n): IterableIterator<T> {\n let index = 0;\n\n start = toIntegerOrInfinity(start);\n start = start === -Infinity ? 0 : start;\n end = toIntegerOrInfinity(end);\n end = end === -Infinity ? 0 : end;\n\n if (start < 0) {\n throw new TypeError('start cannot be a negative finite number');\n }\n\n if (end < 0) {\n throw new TypeError('end cannot be a negative finite number');\n }\n\n if (start === Infinity) {\n return;\n }\n\n for (const item of iteratorToIterable(iterator)) {\n if (index >= start && index < end) {\n yield item;\n }\n\n index++;\n\n if (index > end) {\n break;\n }\n }\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport some from 'core-js-pure/full/iterator/some.js';\n\n/**\n * Determines whether the specified callback function returns true for any element of an iterable.\n *\n * @param predicate A function that accepts up to three arguments. The some method calls the predicate function for each element in the iterable until the predicate returns a value which is coercible to the Boolean value true, or until the end of the iterable.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorSome<T>(iterator: Iterator<T>, predicate: (value: T, index: number) => unknown): boolean {\n return some(iterator, predicate);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport take from 'core-js-pure/full/iterator/take.js';\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","// @ts-expect-error core-js-pure is not typed.\nimport toArray from 'core-js-pure/full/iterator/to-array.js';\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 * @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: Pick<Iterator<T>, 'next'>): T[] {\n return toArray(iteratorLike);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport toAsync from 'core-js-pure/full/iterator/to-async.js';\n\n/**\n * Converts an iterator into async iterator.\n *\n * @return Returns an async iterator.\n *\n * @link https://github.com/tc39/proposal-async-iterator-helpers/blob/main/README.md\n */\nexport function iteratorToAsync<T>(iterator: Iterator<T>): AsyncIterator<T> {\n return toAsync(iterator);\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\nimport toIntegerOrInfinity from './private/toIntegerOrInfinity.ts';\n\n/**\n * Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @param items Elements to insert into the copied array in place of the deleted elements.\n * @returns The copied array.\n */\nexport function iteratorToSpliced<T>(\n iterator: Iterator<T>,\n start?: number | undefined,\n deleteCount?: number | undefined,\n ...items: T[]\n): IterableIterator<T>;\n\n/**\n * Copies an array and removes elements while returning the remaining elements.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @returns A copy of the original array with the remaining elements.\n */\nexport function iteratorToSpliced<T>(\n iterator: Iterator<T>,\n start?: number | undefined,\n deleteCount?: number | undefined\n): IterableIterator<T>;\n\nexport function* iteratorToSpliced<T>(\n iterator: Iterator<T>,\n start: number = 0,\n deleteCount: number = 0,\n ...items: T[]\n): IterableIterator<T> {\n let index = 0;\n\n start = toIntegerOrInfinity(start);\n start = start === -Infinity ? 0 : start;\n\n if (start < 0) {\n throw new TypeError('start cannot be a negative finite number');\n }\n\n let inserted = false;\n\n for (const item of iteratorToIterable(iterator)) {\n if (index + 1 > start && !inserted) {\n yield* items;\n inserted = true;\n }\n\n if (index < start || index >= start + deleteCount) {\n yield item;\n }\n\n index++;\n }\n\n if (!inserted) {\n yield* items;\n }\n}\n","import { iteratorJoin } from './iteratorJoin.ts';\n\n/**\n * Returns a string representation of an iterator.\n */\nexport function iteratorToString<T>(iterator: Iterator<T>): string {\n return iteratorJoin(iterator);\n}\n","import { Observable } from './Observable.ts';\n\nexport function observableFromAsync<T>(iterable: AsyncIterable<T>): Observable<T> {\n return new Observable(subscriber => {\n let closed = false;\n\n (async function () {\n try {\n for await (const value of iterable) {\n if (closed) {\n break;\n }\n\n subscriber.next(value);\n }\n\n subscriber.complete();\n } catch (error) {\n subscriber.error(error);\n }\n })();\n\n return () => {\n closed = true;\n };\n });\n}\n","import { type Observable, type Subscription } from './Observable.ts';\n\nexport function observableSubscribeAsReadable<T>(observable: Observable<T>): ReadableStream<T> {\n let subscription: Subscription;\n\n return new ReadableStream<T>({\n cancel() {\n subscription.unsubscribe();\n },\n start(controller) {\n subscription = observable.subscribe({\n complete() {\n controller.close();\n },\n error(err: unknown) {\n controller.error(err);\n },\n next(value) {\n controller.enqueue(value);\n }\n });\n }\n });\n}\n","export function readableStreamValues<T>(readable: ReadableStream<T>): AsyncIterableIterator<T> {\n const reader = readable.getReader();\n\n const iterable: AsyncIterableIterator<T> = {\n [Symbol.asyncIterator]() {\n return iterable;\n },\n async next(): Promise<IteratorResult<T>> {\n const result = await Promise.race([reader.read(), reader.closed]);\n\n if (!result || result.done) {\n return { done: true, value: undefined };\n }\n\n return { value: result.value };\n },\n async return() {\n // Break/throw inside for-loop will trigger return().\n reader.releaseLock();\n\n return { done: true, value: undefined };\n }\n };\n\n return iterable;\n}\n","import { type Observable } from './Observable.ts';\nimport { observableSubscribeAsReadable } from './observableSubscribeAsReadable.ts';\nimport { readableStreamValues } from './readableStreamValues.ts';\n\nexport function observableValues<T>(observable: Observable<T>): AsyncIterableIterator<T> {\n const readable = observableSubscribeAsReadable(observable);\n const iterable = readableStreamValues(readable);\n\n const cancellableIterable: AsyncIterableIterator<T> = {\n [Symbol.asyncIterator]() {\n return cancellableIterable;\n },\n next() {\n return iterable.next();\n },\n return() {\n try {\n return iterable.return?.() ?? Promise.resolve({ done: true, value: undefined });\n } finally {\n readable.cancel();\n }\n },\n throw(error) {\n return iterable.throw?.(error) ?? Promise.resolve({ done: true, value: undefined });\n }\n };\n\n return cancellableIterable;\n}\n","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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C;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":["import_observable","CoreJSSymbolObservable","CoreJSObservable","asyncGeneratorWithLastValue","drop","every","filter","find","flatMap","forEach","from","map","reduce","some","take","toArray","STILL_ITERATING","generatorWithLastValue","coreJSPromiseWithResolvers","import_drop","drop","import_every","every","import_filter","filter","import_find","find","import_flat_map","flatMap","import_for_each","forEach","import_from","from","import_map","map","import_reduce","reduce","import_some","some","import_take","take","import_to_array","toArray","toAsync"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/Observable.ts","../src/SymbolObservable.ts","../src/asyncGeneratorWithLastValue.ts","../src/asyncIteratorDrop.ts","../src/asyncIteratorEvery.ts","../src/asyncIteratorFilter.ts","../src/asyncIteratorFind.ts","../src/asyncIteratorFlatMap.ts","../src/asyncIteratorForEach.ts","../src/asyncIteratorFrom.ts","../src/asyncIteratorMap.ts","../src/asyncIteratorReduce.ts","../src/asyncIteratorSome.ts","../src/asyncIteratorTake.ts","../src/asyncIteratorToArray.ts","../src/asyncIteratorToAsyncIterable.ts","../src/generatorWithLastValue.ts","../src/private/withResolvers.ts","../src/iterableWritableStream.ts","../src/iteratorToIterable.ts","../src/private/toIntegerOrInfinity.ts","../src/iteratorAt.ts","../src/iteratorConcat.ts","../src/iteratorDrop.ts","../src/iteratorEntries.ts","../src/iteratorEvery.ts","../src/iteratorFilter.ts","../src/iteratorFind.ts","../src/iteratorFindIndex.ts","../src/iteratorFindLast.ts","../src/iteratorFindLastIndex.ts","../src/iteratorFlatMap.ts","../src/iteratorForEach.ts","../src/iteratorFrom.ts","../src/iteratorIncludes.ts","../src/iteratorIndexOf.ts","../src/iteratorJoin.ts","../src/iteratorKeys.ts","../src/iteratorMap.ts","../src/iteratorReduce.ts","../src/iteratorSlice.ts","../src/iteratorSome.ts","../src/iteratorTake.ts","../src/iteratorToArray.ts","../src/iteratorToAsync.ts","../src/iteratorToSpliced.ts","../src/iteratorToString.ts","../src/observableFromAsync.ts","../src/observableSubscribeAsReadable.ts","../src/observableValues.ts","../src/readableStreamFrom.ts","../src/readableStreamValues.ts","../src/private/CriticalSection.ts","../src/private/AsyncIteratorMachinery.ts","../src/private/createAbortError.ts","../src/readableStreamValuesWithSignal.ts"],"sourcesContent":["export * from './Observable.ts';\nexport * from './SymbolObservable.ts';\nexport * from './asyncGeneratorWithLastValue.ts';\nexport * from './asyncIteratorDrop.ts';\nexport * from './asyncIteratorEvery.ts';\nexport * from './asyncIteratorFilter.ts';\nexport * from './asyncIteratorFind.ts';\nexport * from './asyncIteratorFlatMap.ts';\nexport * from './asyncIteratorForEach.ts';\nexport * from './asyncIteratorFrom.ts';\nexport * from './asyncIteratorMap.ts';\nexport * from './asyncIteratorReduce.ts';\nexport * from './asyncIteratorSome.ts';\nexport * from './asyncIteratorTake.ts';\nexport * from './asyncIteratorToArray.ts';\nexport * from './asyncIteratorToAsyncIterable.ts';\nexport * from './generatorWithLastValue.ts';\nexport * from './iterableWritableStream.ts';\nexport * from './iteratorAt.ts';\nexport * from './iteratorConcat.ts';\nexport * from './iteratorDrop.ts';\nexport * from './iteratorEntries.ts';\nexport * from './iteratorEvery.ts';\nexport * from './iteratorFilter.ts';\nexport * from './iteratorFind.ts';\nexport * from './iteratorFindIndex.ts';\nexport * from './iteratorFindLast.ts';\nexport * from './iteratorFindLastIndex.ts';\nexport * from './iteratorFlatMap.ts';\nexport * from './iteratorForEach.ts';\nexport * from './iteratorFrom.ts';\nexport * from './iteratorIncludes.ts';\nexport * from './iteratorIndexOf.ts';\nexport * from './iteratorJoin.ts';\nexport * from './iteratorKeys.ts';\nexport * from './iteratorMap.ts';\nexport * from './iteratorReduce.ts';\nexport * from './iteratorSlice.ts';\nexport * from './iteratorSome.ts';\nexport * from './iteratorTake.ts';\nexport * from './iteratorToArray.ts';\nexport * from './iteratorToAsync.ts';\nexport * from './iteratorToIterable.ts';\nexport * from './iteratorToSpliced.ts';\nexport * from './iteratorToString.ts';\nexport * from './observableFromAsync.ts';\nexport * from './observableSubscribeAsReadable.ts';\nexport * from './observableValues.ts';\nexport * from './readableStreamFrom.ts';\nexport * from './readableStreamValues.ts';\nexport * from './readableStreamValuesWithSignal.ts';\n","// @ts-expect-error core-js is not typed.\nimport CoreJSObservable from 'core-js-pure/full/observable/index.js';\n\nimport { SymbolObservable } from './SymbolObservable.ts';\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","// @ts-expect-error core-js is not typed.\nimport CoreJSSymbolObservable from 'core-js-pure/features/symbol/observable.js';\n\nconst SymbolObservable: unique symbol = CoreJSSymbolObservable;\n\nexport { SymbolObservable };\n","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 ...generator,\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","// @ts-expect-error core-js-pure is not typed.\nimport drop from 'core-js-pure/full/async-iterator/drop.js';\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 asyncIteratorDrop<T>(asyncIterator: AsyncIterator<T>, limit: number): AsyncIterator<T> {\n return drop(asyncIterator, limit);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport every from 'core-js-pure/full/async-iterator/every.js';\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 asyncIteratorEvery<T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<boolean>\n): Promise<boolean>;\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 asyncIteratorEvery<T>(\n iterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<unknown>\n): Promise<boolean>;\n\nexport function asyncIteratorEvery<T>(\n iterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<unknown>\n): Promise<boolean> {\n return every(iterator, predicate);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport filter from 'core-js-pure/full/async-iterator/filter.js';\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 asyncIteratorFilter<T, S extends T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => value is S\n): AsyncIterableIterator<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 asyncIteratorFilter<T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => unknown\n): AsyncIterableIterator<T>;\n\nexport function asyncIteratorFilter<T, S extends T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => unknown\n): AsyncIterableIterator<S> {\n return filter(asyncIterator, predicate);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport find from 'core-js-pure/full/async-iterator/find.js';\n\n/**\n * Returns the value of the first element in the iterator where predicate is true, and undefined\n * otherwise.\n *\n * @param predicate find calls predicate once for each element of the iterator, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function asyncIteratorFind<T, S extends T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<boolean>\n): Promise<S | undefined>;\n\nexport function asyncIteratorFind<T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<unknown>\n): Promise<T | undefined>;\n\nexport function asyncIteratorFind<T, S extends T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<unknown>\n): Promise<S | undefined> {\n return find(asyncIterator, predicate);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport flatMap from 'core-js-pure/full/async-iterator/flat-map.js';\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 asyncIteratorFlatMap<T, U>(\n asyncIterator: AsyncIterator<T>,\n mapperFn: (value: T, index: number) => Promise<U>\n): AsyncIterator<T> {\n return flatMap(asyncIterator, mapperFn);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport forEach from 'core-js-pure/full/async-iterator/for-each.js';\n\n/**\n * Performs the specified action for each element in an iterator.\n *\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn 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 asyncIteratorForEach<T>(\n asyncIterator: AsyncIterator<T>,\n callbackfn: (value: T, index: number) => Promise<void>\n): Promise<void> {\n return forEach(asyncIterator, callbackfn);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport from from 'core-js-pure/full/async-iterator/from.js';\n\n/**\n * `.from` is a static method (unlike the others listed above) which takes an object as an argument. This method allows wrapping \"iterator-like\" objects with an iterator.\n *\n * @return Returns the object if it is already an iterator, returns a wrapping iterator if the passed object implements a callable @@iterator property.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function asyncIteratorFrom<T>(asyncIteratorLike: Pick<AsyncIterator<T>, 'next'>): AsyncIterator<T> {\n return from(asyncIteratorLike);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport map from 'core-js-pure/full/async-iterator/map.js';\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 asyncIteratorMap<T, U>(\n asyncIterator: AsyncIterator<T>,\n callbackfn: (value: T, index: number) => U\n): AsyncIterableIterator<U> {\n return map(asyncIterator, callbackfn);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport reduce from 'core-js-pure/full/async-iterator/reduce.js';\n\n/**\n * Calls the specified callback function for all the elements in an iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n *\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the iterator.\n *\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an iterator value.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function asyncIteratorReduce<T>(\n asyncIterator: AsyncIterator<T>,\n callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => Promise<T>\n): Promise<T>;\n\nexport function asyncIteratorReduce<T>(\n asyncIterator: AsyncIterator<T>,\n callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => Promise<T>,\n initialValue: T\n): T;\n\n/**\n * Calls the specified callback function for all the elements in an iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n *\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the iterator.\n *\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function asyncIteratorReduce<T, U>(\n asyncIterator: AsyncIterator<T>,\n callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => Promise<U>,\n initialValue: U\n): U;\n\nexport function asyncIteratorReduce<T, U = undefined>(\n asyncIterator: AsyncIterator<T>,\n callbackfn: (previousValue: U | undefined, currentValue: T, currentIndex: number) => Promise<U>,\n initialValue?: U\n): Promise<U | undefined> {\n return reduce(asyncIterator, callbackfn, initialValue);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport some from 'core-js-pure/full/async-iterator/some.js';\n\n/**\n * Determines whether the specified callback function returns true for any element of an iterable.\n *\n * @param predicate A function that accepts up to three arguments. The some method calls the predicate function for each element in the iterable until the predicate returns a value which is coercible to the Boolean value true, or until the end of the iterable.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function asyncIteratorSome<T>(\n asyncIterator: AsyncIterator<T>,\n predicate: (value: T, index: number) => Promise<unknown>\n): Promise<boolean> {\n return some(asyncIterator, predicate);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport take from 'core-js-pure/full/async-iterator/take.js';\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 asyncIteratorTake<T>(asyncIterator: AsyncIterator<T>, limit: number): AsyncIterator<T> {\n return take(asyncIterator, limit);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport toArray from 'core-js-pure/full/async-iterator/to-array.js';\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 * @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 asyncIteratorToArray<T>(asyncIteratorLike: Pick<AsyncIterator<T>, 'next'>): Promise<T[]> {\n return toArray(asyncIteratorLike);\n}\n","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","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 ...generator,\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","// @ts-expect-error \"core-js\" is not typed.\nimport coreJSPromiseWithResolvers from 'core-js-pure/full/promise/with-resolvers.js';\n\nexport default function withResolvers<T>(): PromiseWithResolvers<T> {\n return coreJSPromiseWithResolvers();\n}\n","import withResolvers from './private/withResolvers.ts';\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","export function iteratorToIterable<T>(iterator: Iterator<T>): IterableIterator<T> {\n const iterableIterator: IterableIterator<T> = {\n [Symbol.iterator]: () => iterableIterator,\n next: iterator.next.bind(iterator),\n ...(iterator.return ? { return: iterator.return.bind(iterator) } : {}),\n ...(iterator.throw ? { throw: iterator.throw.bind(iterator) } : {})\n };\n\n return iterableIterator;\n}\n","export default function toIntegerOrInfinity(value: number): number {\n if (value === Infinity || value === -Infinity) {\n return value;\n }\n\n return ~~value;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\nimport toIntegerOrInfinity from './private/toIntegerOrInfinity.ts';\n\n/**\n * Returns the item located at the specified index.\n *\n * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.\n */\nexport function iteratorAt<T>(iterator: Iterator<T>, index: number): T | undefined {\n let currentIndex = 0;\n\n index = toIntegerOrInfinity(index);\n\n if (!isFinite(index)) {\n return;\n }\n\n if (index < 0) {\n throw new TypeError('index cannot be a negative finite number');\n }\n\n for (const value of iteratorToIterable(iterator)) {\n if (currentIndex++ === index) {\n return value;\n }\n }\n\n return undefined;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\n\nfunction isIterator<T>(value: unknown): value is Iterator<T> {\n return !!value && typeof value === 'object' && Symbol.iterator in value;\n}\n\n/**\n * Combines two or more iterators.\n * This method returns a new iterator without modifying any existing iterators.\n *\n * @param items Additional iterators and/or items to add to the end of the iterator.\n */\nexport function iteratorConcat<T>(iterator: Iterator<T>, ...items: Iterator<T>[]): IterableIterator<T>;\n\n/**\n * Combines two or more iterators.\n * This method returns a new iterator without modifying any existing iterators.\n *\n * @param items Additional iterators and/or items to add to the end of the iterator.\n */\nexport function iteratorConcat<T>(iterator: Iterator<T>, ...items: (T | Iterator<T>)[]): IterableIterator<T>;\n\nexport function* iteratorConcat<T>(iterator: Iterator<T>, ...items: (T | Iterator<T>)[]): IterableIterator<T> {\n yield* iteratorToIterable(iterator);\n\n for (const item of items) {\n if (isIterator(item)) {\n yield* iteratorToIterable(item);\n } else {\n yield item;\n }\n }\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport drop from 'core-js-pure/full/iterator/drop.js';\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","import { iteratorToIterable } from './iteratorToIterable.ts';\n\n/**\n * Returns an iterator of key, value pairs for every entry in the iterator\n */\nexport function* iteratorEntries<T>(iterator: Iterator<T>): IterableIterator<[number, T]> {\n let index = 0;\n\n for (const value of iteratorToIterable(iterator)) {\n yield [index++, value];\n }\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport every from 'core-js-pure/full/iterator/every.js';\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","// @ts-expect-error core-js-pure is not typed.\nimport filter from 'core-js-pure/full/iterator/filter.js';\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","// @ts-expect-error core-js-pure is not typed.\nimport find from 'core-js-pure/full/iterator/find.js';\n\n/**\n * Returns the value of the first element in the iterator where predicate is true, and undefined\n * otherwise.\n *\n * @param predicate find calls predicate once for each element of the iterator, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorFind<T, S extends T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number) => value is S\n): S | undefined;\n\nexport function iteratorFind<T>(iterator: Iterator<T>, predicate: (value: T, index: number) => unknown): T | undefined;\n\nexport function iteratorFind<T, S extends T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number) => unknown\n): S | undefined {\n return find(iterator, predicate);\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\n\n/**\n * Returns the index of the first element in the iterator where predicate is true, and -1\n * otherwise.\n *\n * @param predicate find calls predicate once for each element of the iterator, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iteratorFindIndex<T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number, obj: Iterator<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): number {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iteratorToIterable(iterator)) {\n if (boundPredicate(value, index, iterator)) {\n return index;\n }\n\n index++;\n }\n\n return -1;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\n\n/**\n * Returns the value of the last element in the iterator where predicate is true, and undefined\n * otherwise.\n *\n * @param predicate findLast calls predicate once for each element of the iterator, in descending\n * order, until it finds one where predicate returns true. If such an element is found, findLast\n * immediately returns that element value. Otherwise, findLast returns undefined.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iteratorFindLast<T, S extends T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number, iterator: Iterator<T>) => value is S,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): S | undefined;\n\nexport function iteratorFindLast<T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number, iterator: Iterator<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): T | undefined;\n\nexport function iteratorFindLast<T, S extends T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number, iterator: Iterator<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): S | undefined {\n let index = 0;\n let last: S | undefined;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iteratorToIterable(iterator)) {\n if (boundPredicate(value, index++, iterator)) {\n last = value as S;\n }\n }\n\n return last;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\n\n/**\n * Returns the index of the last element in the iterator where predicate is true, and -1\n * otherwise.\n *\n * @param predicate findLastIndex calls predicate once for each element of the iterator, in descending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iteratorFindLastIndex<T>(\n iterator: Iterator<T>,\n predicate: (value: T, index: number, iterator: Iterator<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): number {\n let index = 0;\n let lastIndex: number = -1;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iteratorToIterable(iterator)) {\n if (boundPredicate(value, index, iterator)) {\n lastIndex = index;\n }\n\n index++;\n }\n\n return lastIndex;\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport flatMap from 'core-js-pure/full/iterator/flat-map.js';\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>(iterator: Iterator<T>, mapperFn: (value: T, index: number) => U): Iterator<T> {\n return flatMap(iterator, mapperFn);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport forEach from 'core-js-pure/full/iterator/for-each.js';\n\n/**\n * Performs the specified action for each element in an iterator.\n *\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn 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 iteratorForEach<T>(iterator: Iterator<T>, callbackfn: (value: T, index: number) => void): void {\n forEach(iterator, callbackfn);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport from from 'core-js-pure/full/iterator/from.js';\n\n/**\n * `.from` is a static method (unlike the others listed above) which takes an object as an argument. This method allows wrapping \"iterator-like\" objects with an iterator.\n *\n * @return Returns the object if it is already an iterator, returns a wrapping iterator if the passed object implements a callable @@iterator property.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorFrom<T>(iteratorLike: Pick<Iterator<T>, 'next'>): Iterator<T> {\n return from(iteratorLike);\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\nimport toIntegerOrInfinity from './private/toIntegerOrInfinity.ts';\n\n/**\n * Determines whether an iterator includes a certain element, returning true or false as appropriate.\n *\n * @param searchElement The element to search for.\n * @param fromIndex The position in this iterator at which to begin searching for searchElement.\n */\nexport function iteratorIncludes<T>(iterator: Iterator<T>, searchElement: T, fromIndex: number = 0): boolean {\n let index = 0;\n\n fromIndex = toIntegerOrInfinity(fromIndex);\n\n if (fromIndex !== Infinity) {\n fromIndex = fromIndex === -Infinity ? 0 : fromIndex;\n\n if (fromIndex < 0) {\n // TODO: Support negative fromIndex.\n throw new TypeError('fromIndex cannot be a negative finite number');\n }\n\n for (const item of iteratorToIterable(iterator)) {\n if (index++ >= fromIndex && Object.is(item, searchElement)) {\n return true;\n }\n }\n }\n\n return false;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\nimport toIntegerOrInfinity from './private/toIntegerOrInfinity.ts';\n\n/**\n * Returns the index of the first occurrence of a value in an iterator, or -1 if it is not present.\n *\n * @param searchElement The value to locate in the iterator.\n * @param fromIndex The iterator index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\nexport function iteratorIndexOf<T>(iterator: Iterator<T>, searchElement: T, fromIndex: number = 0): number {\n let index = 0;\n\n fromIndex = toIntegerOrInfinity(fromIndex);\n\n if (fromIndex !== Infinity) {\n fromIndex = fromIndex === -Infinity ? 0 : fromIndex;\n\n if (fromIndex < 0) {\n // TODO: Support negative fromIndex.\n throw new TypeError('fromIndex cannot be a negative finite number');\n }\n\n for (const item of iteratorToIterable(iterator)) {\n if (index >= fromIndex && Object.is(item, searchElement)) {\n return index;\n }\n\n index++;\n }\n }\n\n return -1;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\n\n/**\n * Adds all the elements of an iterator into a string, separated by the specified separator string.\n *\n * @param separator A string used to separate one element of the iterator from the next in the resulting string. If omitted, the iterator elements are separated with a comma.\n */\nexport function iteratorJoin<T>(iterator: Iterator<T>, separator: string = ','): string {\n let index = 0;\n let result = '';\n\n for (const item of iteratorToIterable(iterator)) {\n if (index) {\n result += separator;\n }\n\n if (typeof item !== 'undefined' && item !== null) {\n result += item;\n }\n\n index++;\n }\n\n return result;\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\n\n/**\n * Returns an iterator of keys in the iterator\n */\nexport function* iteratorKeys<T>(iterator: Iterator<T>): IterableIterator<number> {\n let index = 0;\n\n for (const _ of iteratorToIterable(iterator)) {\n yield index++;\n }\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport map from 'core-js-pure/full/iterator/map.js';\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","// @ts-expect-error core-js-pure is not typed.\nimport reduce from 'core-js-pure/full/iterator/reduce.js';\n\n/**\n * Calls the specified callback function for all the elements in an iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n *\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the iterator.\n *\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an iterator value.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorReduce<T>(\n iterator: Iterator<T>,\n callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T\n): T;\n\nexport function iteratorReduce<T>(\n iterator: Iterator<T>,\n callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T,\n initialValue: T\n): T;\n\n/**\n * Calls the specified callback function for all the elements in an iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n *\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the iterator.\n *\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorReduce<T, U>(\n iterator: Iterator<T>,\n callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U,\n initialValue: U\n): U;\n\nexport function iteratorReduce<T, U = undefined>(\n iterator: Iterator<T>,\n callbackfn: (previousValue: U | undefined, currentValue: T, currentIndex: number) => U,\n initialValue?: U\n): U | undefined {\n return reduce(iterator, callbackfn, initialValue);\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\nimport toIntegerOrInfinity from './private/toIntegerOrInfinity.ts';\n\n/**\n * Returns a copy of a section of an iterator.\n * For both start and end, a negative index can be used to indicate an offset from the end of the iterator.\n * For example, -2 refers to the second to last element of the iterator.\n *\n * @param start The beginning index of the specified portion of the iterator.\n * If start is undefined, then the slice begins at index 0.\n *\n * @param end The end index of the specified portion of the iterator. This is exclusive of the element at the index 'end'.\n * If end is undefined, then the slice extends to the end of the iterator.\n */\nexport function* iteratorSlice<T>(\n iterator: Iterator<T>,\n start: number = 0,\n end: number = Infinity\n): IterableIterator<T> {\n let index = 0;\n\n start = toIntegerOrInfinity(start);\n start = start === -Infinity ? 0 : start;\n end = toIntegerOrInfinity(end);\n end = end === -Infinity ? 0 : end;\n\n if (start < 0) {\n throw new TypeError('start cannot be a negative finite number');\n }\n\n if (end < 0) {\n throw new TypeError('end cannot be a negative finite number');\n }\n\n if (start === Infinity) {\n return;\n }\n\n for (const item of iteratorToIterable(iterator)) {\n if (index >= start && index < end) {\n yield item;\n }\n\n index++;\n\n if (index > end) {\n break;\n }\n }\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport some from 'core-js-pure/full/iterator/some.js';\n\n/**\n * Determines whether the specified callback function returns true for any element of an iterable.\n *\n * @param predicate A function that accepts up to three arguments. The some method calls the predicate function for each element in the iterable until the predicate returns a value which is coercible to the Boolean value true, or until the end of the iterable.\n *\n * @link https://github.com/tc39/proposal-iterator-helpers/blob/main/README.md\n */\nexport function iteratorSome<T>(iterator: Iterator<T>, predicate: (value: T, index: number) => unknown): boolean {\n return some(iterator, predicate);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport take from 'core-js-pure/full/iterator/take.js';\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","// @ts-expect-error core-js-pure is not typed.\nimport toArray from 'core-js-pure/full/iterator/to-array.js';\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 * @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: Pick<Iterator<T>, 'next'>): T[] {\n return toArray(iteratorLike);\n}\n","// @ts-expect-error core-js-pure is not typed.\nimport toAsync from 'core-js-pure/full/iterator/to-async.js';\n\n/**\n * Converts an iterator into async iterator.\n *\n * @return Returns an async iterator.\n *\n * @link https://github.com/tc39/proposal-async-iterator-helpers/blob/main/README.md\n */\nexport function iteratorToAsync<T>(iterator: Iterator<T>): AsyncIterator<T> {\n return toAsync(iterator);\n}\n","import { iteratorToIterable } from './iteratorToIterable.ts';\nimport toIntegerOrInfinity from './private/toIntegerOrInfinity.ts';\n\n/**\n * Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @param items Elements to insert into the copied array in place of the deleted elements.\n * @returns The copied array.\n */\nexport function iteratorToSpliced<T>(\n iterator: Iterator<T>,\n start?: number | undefined,\n deleteCount?: number | undefined,\n ...items: T[]\n): IterableIterator<T>;\n\n/**\n * Copies an array and removes elements while returning the remaining elements.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @returns A copy of the original array with the remaining elements.\n */\nexport function iteratorToSpliced<T>(\n iterator: Iterator<T>,\n start?: number | undefined,\n deleteCount?: number | undefined\n): IterableIterator<T>;\n\nexport function* iteratorToSpliced<T>(\n iterator: Iterator<T>,\n start: number = 0,\n deleteCount: number = 0,\n ...items: T[]\n): IterableIterator<T> {\n let index = 0;\n\n start = toIntegerOrInfinity(start);\n start = start === -Infinity ? 0 : start;\n\n if (start < 0) {\n throw new TypeError('start cannot be a negative finite number');\n }\n\n let inserted = false;\n\n for (const item of iteratorToIterable(iterator)) {\n if (index + 1 > start && !inserted) {\n yield* items;\n inserted = true;\n }\n\n if (index < start || index >= start + deleteCount) {\n yield item;\n }\n\n index++;\n }\n\n if (!inserted) {\n yield* items;\n }\n}\n","import { iteratorJoin } from './iteratorJoin.ts';\n\n/**\n * Returns a string representation of an iterator.\n */\nexport function iteratorToString<T>(iterator: Iterator<T>): string {\n return iteratorJoin(iterator);\n}\n","import { Observable } from './Observable.ts';\n\nexport function observableFromAsync<T>(iterable: AsyncIterable<T>): Observable<T> {\n return new Observable(subscriber => {\n let closed = false;\n\n (async function () {\n try {\n for await (const value of iterable) {\n if (closed) {\n break;\n }\n\n subscriber.next(value);\n }\n\n subscriber.complete();\n } catch (error) {\n subscriber.error(error);\n }\n })();\n\n return () => {\n closed = true;\n };\n });\n}\n","import { type Observable, type Subscription } from './Observable.ts';\n\nexport function observableSubscribeAsReadable<T>(observable: Observable<T>): ReadableStream<T> {\n let subscription: Subscription;\n\n return new ReadableStream<T>({\n cancel() {\n subscription.unsubscribe();\n },\n start(controller) {\n subscription = observable.subscribe({\n complete() {\n controller.close();\n },\n error(err: unknown) {\n controller.error(err);\n },\n next(value) {\n controller.enqueue(value);\n }\n });\n }\n });\n}\n","import { type Observable } from './Observable.ts';\nimport { observableSubscribeAsReadable } from './observableSubscribeAsReadable.ts';\n\nexport function observableValues<T>(observable: Observable<T>): AsyncIterableIterator<T> {\n return observableSubscribeAsReadable(observable).values();\n}\n","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","/**\n * This is deprecated. You should use `ReadableStream.values` instead.\n *\n * @deprecated\n */\nexport function readableStreamValues<T>(\n readable: ReadableStream<T>,\n options?: ReadableStreamIteratorOptions | undefined\n): AsyncIterableIterator<T> {\n return readable.values(options);\n}\n","export default class CriticalSection {\n #callbacks: (() => void)[] = [];\n\n enter<T>(fn: () => Promise<T>): Promise<T> {\n const fnResolver = Promise.withResolvers<T>();\n\n // const callback = () =>\n // fn()\n // .then(\n // value => fnResolver.resolve(value),\n // reason => fnResolver.reject(reason)\n // )\n // .then(() => {\n // /* istanbul ignore if */\n // if (this.#callbacks.shift() !== callback) {\n // throw new Error('ASSERTION: The first resolver must be self.');\n // }\n\n // this.#callbacks[0]?.();\n // });\n\n const callback = async () => {\n try {\n fnResolver.resolve(await fn());\n } catch (error) {\n fnResolver.reject(error);\n }\n\n /* istanbul ignore if */\n if (this.#callbacks.shift() !== callback) {\n throw new Error('ASSERTION: The first resolver must be self.');\n }\n\n this.#callbacks[0]?.();\n };\n\n this.#callbacks.push(callback);\n\n this.#callbacks[0] === callback && callback();\n\n return fnResolver.promise;\n }\n}\n","import CriticalSection from './CriticalSection.ts';\n\n/**\n * This machinery protect the logic of iterator/generator. It guarantees:\n *\n * - next(), return(), throw() are in the same critical section\n * - They will be processed sequentially\n * - When the iterator is done\n * - next() will always return { done: true, value: undefined }\n * - return(value) will always return { done: true, value }, without calling underlying return()\n * - throw(reason) will always throw reason, without calling underlying throw()\n */\nexport default class AsyncIteratorMachinery<T, TReturn, TNext> implements AsyncIteratorObject<T, TReturn, TNext> {\n constructor(iterator: AsyncIterator<T, TReturn, TNext>) {\n this.#criticalSection = new CriticalSection();\n this.#done = false;\n\n const enter = this.#criticalSection.enter.bind(this.#criticalSection);\n\n const return_ = iterator.return && iterator.return.bind(iterator);\n const throw_ = iterator.throw && iterator.throw.bind(iterator);\n\n this.next = (...[value]) =>\n enter(async () => {\n if (this.#done) {\n // Seems a bug in TypeScript that it doesn't allow undefined as TReturn for AsyncIterator\n return Promise.resolve({ done: true, value: undefined as TReturn });\n }\n\n const result = await iterator.next(...(value ? [value] : []));\n\n if (result.done) {\n this.#done = true;\n }\n\n return result;\n });\n\n if (return_) {\n this.return = value =>\n enter(async () => {\n if (this.#done) {\n return {\n done: true,\n value: typeof value === 'undefined' ? (value as TReturn) : await value\n };\n }\n\n this.#done = true;\n\n return return_(value);\n });\n }\n\n if (throw_) {\n this.throw = reason =>\n enter(() => {\n if (this.#done) {\n return Promise.reject(reason);\n }\n\n this.#done = true;\n\n return throw_(reason);\n });\n }\n }\n\n #criticalSection: CriticalSection;\n #done: boolean;\n\n async [Symbol.asyncDispose]() {}\n\n [Symbol.asyncIterator]() {\n return this;\n }\n\n next: (...[value]: [] | [TNext]) => Promise<IteratorResult<T, TReturn>>;\n return?: (value?: TReturn | PromiseLike<TReturn> | undefined) => Promise<IteratorResult<T, TReturn>>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n throw?: (e?: any) => Promise<IteratorResult<T, TReturn>>;\n}\n","const ERROR_MESSAGE = 'The operation is aborted';\nconst ERROR_NAME = 'AbortError';\n\nexport default function createAbortError(): (DOMException & { name: 'AbortError' }) | Error {\n if (typeof globalThis.DOMException === 'undefined') {\n const error = new Error(ERROR_MESSAGE);\n\n error.name = ERROR_NAME;\n\n return error;\n } else {\n return new DOMException(ERROR_MESSAGE, ERROR_NAME);\n }\n}\n","import AsyncIteratorMachinery from './private/AsyncIteratorMachinery.ts';\nimport createAbortError from './private/createAbortError.ts';\n\ntype ReadableStreamIteratorWithSignalOptions = ReadableStreamIteratorOptions & {\n signal?: AbortSignal | undefined;\n};\n\ntype ReadableStreamIteratorReadRequest<T> = {\n chunk(value: T): void;\n close(): void;\n error(error: unknown): void;\n};\n\nclass ReadableStreamIterator<T> implements ReadableStreamAsyncIterator<T> {\n // The asynchronous iterator initialization steps for a ReadableStream, given stream, iterator, and args, are:\n constructor(\n stream: ReadableStream<T>,\n args: [{ preventCancel?: boolean | undefined; signal?: AbortSignal | undefined }]\n ) {\n // 1. Let reader be ? AcquireReadableStreamDefaultReader(stream).\n const reader = stream.getReader();\n\n // 2. Set iterator’s reader to reader.\n this.#reader = reader;\n\n // 3. Let preventCancel be args[0][\"preventCancel\"].\n const preventCancel = !!args[0].preventCancel;\n\n // 4. Set iterator’s prevent cancel to preventCancel.\n this.#preventCancel = preventCancel;\n\n this.#signal = args[0].signal;\n\n this.#signal?.addEventListener(\n 'abort',\n async () => {\n // Ignore cancel() rejections.\n this.#preventCancel || reader.cancel(createAbortError());\n\n reader.releaseLock();\n },\n { once: true }\n );\n }\n\n #preventCancel: boolean;\n #reader: ReadableStreamDefaultReader<T>;\n #readRequests: ReadableStreamIteratorReadRequest<T>[] = [];\n #signal: AbortSignal | undefined;\n\n [Symbol.asyncIterator]() {\n return this;\n }\n\n async [Symbol.asyncDispose]() {}\n\n // The get the next iteration result steps for a ReadableStream, given stream and iterator, are:\n // next(...[value]: [] | [any]): Promise<IteratorResult<T, any>> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n next: () => Promise<IteratorResult<T, any>> = () => {\n if (this.#signal?.aborted) {\n return Promise.reject(createAbortError());\n }\n\n // Iterator machinery: iterator is busy, don't start return().\n const nextResolvers = Promise.withResolvers<void>();\n\n // 1. Let reader be iterator’s reader.\n const reader = this.#reader;\n\n // 2. Assert: reader.[[stream]] is not undefined.\n\n // 3. Let promise be a new promise.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const resolvers = Promise.withResolvers<IteratorResult<T, any>>();\n\n // 4. Let readRequest be a new read request with the following items:\n const request: ReadableStreamIteratorReadRequest<T> = {\n // chunk steps, given chunk\n chunk(value) {\n // Resolve promise with chunk.\n resolvers.resolve({ done: false, value });\n },\n // close steps\n close() {\n // Perform ! ReadableStreamDefaultReaderRelease(reader).\n reader.releaseLock();\n\n // Resolve promise with end of iteration.\n resolvers.resolve({ done: true, value: undefined });\n },\n // error steps, given e\n error(reason) {\n // Perform ! ReadableStreamDefaultReaderRelease(reader).\n reader.releaseLock();\n\n // Reject promise with e.\n resolvers.reject(reason);\n }\n };\n\n this.#readRequests.push(request);\n\n // 5. Perform ! ReadableStreamDefaultReaderRead(this, readRequest).\n (async () => {\n try {\n const result = await reader.read();\n\n if (result.done) {\n if (this.#signal?.aborted) {\n request.error(createAbortError());\n }\n\n request.close();\n } else {\n request.chunk(result.value);\n }\n } catch (error) {\n if (this.#signal?.aborted) {\n request.error(createAbortError());\n } else {\n request.error(error);\n }\n } finally {\n nextResolvers.resolve();\n }\n })();\n\n // 6. Return promise.\n return resolvers.promise;\n };\n\n // The asynchronous iterator return steps for a ReadableStream, given stream, iterator, and arg, are:\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async return(value?: any): Promise<IteratorResult<T, any>> {\n if (this.#signal?.aborted) {\n return Promise.reject(createAbortError());\n }\n\n // 1. Let reader be iterator’s reader.\n const reader = this.#reader;\n // 2. Assert: reader.[[stream]] is not undefined.\n // 3. Assert: reader.[[readRequests]] is empty, as the async iterator machinery guarantees that any previous calls to next() have settled before this is called.\n\n // 4. If iterator’s prevent cancel is false:\n if (!this.#preventCancel) {\n // 1. Let result be ! ReadableStreamReaderGenericCancel(reader, arg).\n const cancelPromise = reader.cancel(value);\n\n // --- Seems WHATWG spec bug: if stream errored, we will fail at cancel() and would never able to call releaseLock(). ---\n // --- Instead, regardless cancel() failed or not, we should release the reader lock. ---\n\n // 2. Perform ! ReadableStreamDefaultReaderRelease(reader).\n reader.releaseLock();\n\n await cancelPromise;\n\n // 3. Return result.\n // --- Seems Node.js 22.14.0 implementation is different from W3C spec, see https://github.com/nodejs/node/issues/57681 ---\n // return { done: true, value: undefined };\n return { done: true, value };\n }\n\n // 5. Perform ! ReadableStreamDefaultReaderRelease(reader).\n reader.releaseLock();\n\n // 6. Return a promise resolved with undefined.\n // --- Seems Node.js 22.14.0 implementation is different from W3C spec, see https://github.com/nodejs/node/issues/57681 ---\n // return { done: true, value: undefined };\n return { done: true, value };\n }\n}\n\n/**\n * This is based on WHATWG Streams Asynchronous Iteration specification.\n *\n * @see https://streams.spec.whatwg.org/#rs-asynciterator\n *\n * @param stream\n * @param options\n * @returns\n */\nexport function readableStreamValuesWithSignal<T>(\n stream: ReadableStream<T>,\n options?: ReadableStreamIteratorWithSignalOptions | undefined\n): ReadableStreamAsyncIterator<T> {\n return new AsyncIteratorMachinery(new ReadableStreamIterator(stream, [options || {}]));\n}\n\nexport { type ReadableStreamIteratorWithSignalOptions };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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AA;AAAA,EAIA,MAAM,OAAO,OAA8C;AAtI7D;AAuII,SAAI,UAAK,YAAL,mBAAc,SAAS;AACzB,aAAO,QAAQ,OAAO,iBAAiB,CAAC;AAAA,IAC1C;AAGA,UAAM,SAAS,KAAK;AAKpB,QAAI,CAAC,KAAK,gBAAgB;AAExB,YAAM,gBAAgB,OAAO,OAAO,KAAK;AAMzC,aAAO,YAAY;AAEnB,YAAM;AAKN,aAAO,EAAE,MAAM,MAAM,MAAM;AAAA,IAC7B;AAGA,WAAO,YAAY;AAKnB,WAAO,EAAE,MAAM,MAAM,MAAM;AAAA,EAC7B;AACF;AAWO,SAAS,+BACd,QACA,SACgC;AAChC,SAAO,IAAI,uBAAuB,IAAI,uBAAuB,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AACvF;","names":["import_observable","CoreJSSymbolObservable","CoreJSObservable","asyncGeneratorWithLastValue","drop","every","filter","find","flatMap","forEach","from","map","reduce","some","take","toArray","STILL_ITERATING","generatorWithLastValue","coreJSPromiseWithResolvers","import_drop","drop","import_every","every","import_filter","filter","import_find","find","import_flat_map","flatMap","import_for_each","forEach","import_from","from","import_map","map","import_reduce","reduce","import_some","some","import_take","take","import_to_array","toArray","toAsync","_a"]}
|
package/dist/iter-fest.mjs
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readableStreamFrom
|
|
3
3
|
} from "./chunk-YJSIVBF7.mjs";
|
|
4
|
+
import {
|
|
5
|
+
readableStreamValues
|
|
6
|
+
} from "./chunk-6ZEIOTH6.mjs";
|
|
7
|
+
import {
|
|
8
|
+
readableStreamValuesWithSignal
|
|
9
|
+
} from "./chunk-4P4GJT2O.mjs";
|
|
4
10
|
import {
|
|
5
11
|
iteratorToAsync
|
|
6
12
|
} from "./chunk-VP5SFGCE.mjs";
|
|
@@ -21,10 +27,7 @@ import {
|
|
|
21
27
|
} from "./chunk-BZKIZ3TX.mjs";
|
|
22
28
|
import {
|
|
23
29
|
observableValues
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import {
|
|
26
|
-
readableStreamValues
|
|
27
|
-
} from "./chunk-RVIERPEV.mjs";
|
|
30
|
+
} from "./chunk-YGRCFTJT.mjs";
|
|
28
31
|
import {
|
|
29
32
|
observableSubscribeAsReadable
|
|
30
33
|
} from "./chunk-GOJ2PI5W.mjs";
|
|
@@ -127,10 +130,10 @@ import {
|
|
|
127
130
|
} from "./chunk-P4OSZLEH.mjs";
|
|
128
131
|
import {
|
|
129
132
|
generatorWithLastValue
|
|
130
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-AMBNMMKA.mjs";
|
|
131
134
|
import {
|
|
132
135
|
asyncGeneratorWithLastValue
|
|
133
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-P6MH6RRG.mjs";
|
|
134
137
|
import {
|
|
135
138
|
asyncIteratorDrop
|
|
136
139
|
} from "./chunk-IBEDYMB6.mjs";
|
|
@@ -199,6 +202,7 @@ export {
|
|
|
199
202
|
observableSubscribeAsReadable,
|
|
200
203
|
observableValues,
|
|
201
204
|
readableStreamFrom,
|
|
202
|
-
readableStreamValues
|
|
205
|
+
readableStreamValues,
|
|
206
|
+
readableStreamValuesWithSignal
|
|
203
207
|
};
|
|
204
208
|
//# sourceMappingURL=iter-fest.mjs.map
|
|
@@ -47,53 +47,9 @@ function observableSubscribeAsReadable(observable) {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
// src/readableStreamValues.ts
|
|
51
|
-
function readableStreamValues(readable) {
|
|
52
|
-
const reader = readable.getReader();
|
|
53
|
-
const iterable = {
|
|
54
|
-
[Symbol.asyncIterator]() {
|
|
55
|
-
return iterable;
|
|
56
|
-
},
|
|
57
|
-
async next() {
|
|
58
|
-
const result = await Promise.race([reader.read(), reader.closed]);
|
|
59
|
-
if (!result || result.done) {
|
|
60
|
-
return { done: true, value: void 0 };
|
|
61
|
-
}
|
|
62
|
-
return { value: result.value };
|
|
63
|
-
},
|
|
64
|
-
async return() {
|
|
65
|
-
reader.releaseLock();
|
|
66
|
-
return { done: true, value: void 0 };
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
return iterable;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
50
|
// src/observableValues.ts
|
|
73
51
|
function observableValues(observable) {
|
|
74
|
-
|
|
75
|
-
const iterable = readableStreamValues(readable);
|
|
76
|
-
const cancellableIterable = {
|
|
77
|
-
[Symbol.asyncIterator]() {
|
|
78
|
-
return cancellableIterable;
|
|
79
|
-
},
|
|
80
|
-
next() {
|
|
81
|
-
return iterable.next();
|
|
82
|
-
},
|
|
83
|
-
return() {
|
|
84
|
-
var _a;
|
|
85
|
-
try {
|
|
86
|
-
return ((_a = iterable.return) == null ? void 0 : _a.call(iterable)) ?? Promise.resolve({ done: true, value: void 0 });
|
|
87
|
-
} finally {
|
|
88
|
-
readable.cancel();
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
throw(error) {
|
|
92
|
-
var _a;
|
|
93
|
-
return ((_a = iterable.throw) == null ? void 0 : _a.call(iterable, error)) ?? Promise.resolve({ done: true, value: void 0 });
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
return cancellableIterable;
|
|
52
|
+
return observableSubscribeAsReadable(observable).values();
|
|
97
53
|
}
|
|
98
54
|
// Annotate the CommonJS export names for ESM import in node:
|
|
99
55
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/observableValues.ts","../src/observableSubscribeAsReadable.ts"
|
|
1
|
+
{"version":3,"sources":["../src/observableValues.ts","../src/observableSubscribeAsReadable.ts"],"sourcesContent":["import { type Observable } from './Observable.ts';\nimport { observableSubscribeAsReadable } from './observableSubscribeAsReadable.ts';\n\nexport function observableValues<T>(observable: Observable<T>): AsyncIterableIterator<T> {\n return observableSubscribeAsReadable(observable).values();\n}\n","import { type Observable, type Subscription } from './Observable.ts';\n\nexport function observableSubscribeAsReadable<T>(observable: Observable<T>): ReadableStream<T> {\n let subscription: Subscription;\n\n return new ReadableStream<T>({\n cancel() {\n subscription.unsubscribe();\n },\n start(controller) {\n subscription = observable.subscribe({\n complete() {\n controller.close();\n },\n error(err: unknown) {\n controller.error(err);\n },\n next(value) {\n controller.enqueue(value);\n }\n });\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,SAAS,8BAAiC,YAA8C;AAC7F,MAAI;AAEJ,SAAO,IAAI,eAAkB;AAAA,IAC3B,SAAS;AACP,mBAAa,YAAY;AAAA,IAC3B;AAAA,IACA,MAAM,YAAY;AAChB,qBAAe,WAAW,UAAU;AAAA,QAClC,WAAW;AACT,qBAAW,MAAM;AAAA,QACnB;AAAA,QACA,MAAM,KAAc;AAClB,qBAAW,MAAM,GAAG;AAAA,QACtB;AAAA,QACA,KAAK,OAAO;AACV,qBAAW,QAAQ,KAAK;AAAA,QAC1B;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;;;ADpBO,SAAS,iBAAoB,YAAqD;AACvF,SAAO,8BAA8B,UAAU,EAAE,OAAO;AAC1D;","names":[]}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This is deprecated. You should use `ReadableStream.values` instead.
|
|
3
|
+
*
|
|
4
|
+
* @deprecated
|
|
5
|
+
*/
|
|
6
|
+
declare function readableStreamValues<T>(readable: ReadableStream<T>, options?: ReadableStreamIteratorOptions | undefined): AsyncIterableIterator<T>;
|
|
2
7
|
|
|
3
8
|
export { readableStreamValues };
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This is deprecated. You should use `ReadableStream.values` instead.
|
|
3
|
+
*
|
|
4
|
+
* @deprecated
|
|
5
|
+
*/
|
|
6
|
+
declare function readableStreamValues<T>(readable: ReadableStream<T>, options?: ReadableStreamIteratorOptions | undefined): AsyncIterableIterator<T>;
|
|
2
7
|
|
|
3
8
|
export { readableStreamValues };
|
|
@@ -23,25 +23,8 @@ __export(readableStreamValues_exports, {
|
|
|
23
23
|
readableStreamValues: () => readableStreamValues
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(readableStreamValues_exports);
|
|
26
|
-
function readableStreamValues(readable) {
|
|
27
|
-
|
|
28
|
-
const iterable = {
|
|
29
|
-
[Symbol.asyncIterator]() {
|
|
30
|
-
return iterable;
|
|
31
|
-
},
|
|
32
|
-
async next() {
|
|
33
|
-
const result = await Promise.race([reader.read(), reader.closed]);
|
|
34
|
-
if (!result || result.done) {
|
|
35
|
-
return { done: true, value: void 0 };
|
|
36
|
-
}
|
|
37
|
-
return { value: result.value };
|
|
38
|
-
},
|
|
39
|
-
async return() {
|
|
40
|
-
reader.releaseLock();
|
|
41
|
-
return { done: true, value: void 0 };
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
return iterable;
|
|
26
|
+
function readableStreamValues(readable, options) {
|
|
27
|
+
return readable.values(options);
|
|
45
28
|
}
|
|
46
29
|
// Annotate the CommonJS export names for ESM import in node:
|
|
47
30
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/readableStreamValues.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/readableStreamValues.ts"],"sourcesContent":["/**\n * This is deprecated. You should use `ReadableStream.values` instead.\n *\n * @deprecated\n */\nexport function readableStreamValues<T>(\n readable: ReadableStream<T>,\n options?: ReadableStreamIteratorOptions | undefined\n): AsyncIterableIterator<T> {\n return readable.values(options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,SAAS,qBACd,UACA,SAC0B;AAC1B,SAAO,SAAS,OAAO,OAAO;AAChC;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type ReadableStreamIteratorWithSignalOptions = ReadableStreamIteratorOptions & {
|
|
2
|
+
signal?: AbortSignal | undefined;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* This is based on WHATWG Streams Asynchronous Iteration specification.
|
|
6
|
+
*
|
|
7
|
+
* @see https://streams.spec.whatwg.org/#rs-asynciterator
|
|
8
|
+
*
|
|
9
|
+
* @param stream
|
|
10
|
+
* @param options
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare function readableStreamValuesWithSignal<T>(stream: ReadableStream<T>, options?: ReadableStreamIteratorWithSignalOptions | undefined): ReadableStreamAsyncIterator<T>;
|
|
14
|
+
|
|
15
|
+
export { type ReadableStreamIteratorWithSignalOptions, readableStreamValuesWithSignal };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type ReadableStreamIteratorWithSignalOptions = ReadableStreamIteratorOptions & {
|
|
2
|
+
signal?: AbortSignal | undefined;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* This is based on WHATWG Streams Asynchronous Iteration specification.
|
|
6
|
+
*
|
|
7
|
+
* @see https://streams.spec.whatwg.org/#rs-asynciterator
|
|
8
|
+
*
|
|
9
|
+
* @param stream
|
|
10
|
+
* @param options
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare function readableStreamValuesWithSignal<T>(stream: ReadableStream<T>, options?: ReadableStreamIteratorWithSignalOptions | undefined): ReadableStreamAsyncIterator<T>;
|
|
14
|
+
|
|
15
|
+
export { type ReadableStreamIteratorWithSignalOptions, readableStreamValuesWithSignal };
|