//#region src/utils/streams.d.ts /** * Stream / async-iterable helpers. All helpers honor `AbortSignal` * propagation: when the supplied signal aborts, the underlying * iterator's `return()` method is invoked so that resources held by the * upstream generator are released cleanly. * * @packageDocumentation */ /** * Drain an `AsyncIterable` into an array. * * @stable */ declare function collect(source: AsyncIterable, signal?: AbortSignal): Promise; /** * Map every value of an async iterable. The mapper may be async. * Cancellation via `signal` is honored. * * @stable */ declare function mapStream(source: AsyncIterable, fn: (value: T, index: number) => U | Promise, signal?: AbortSignal): AsyncIterable; /** * Filter values produced by `source`. The predicate may be async. * * @stable */ declare function filter(source: AsyncIterable, pred: (value: T, index: number) => boolean | Promise, signal?: AbortSignal): AsyncIterable; /** * Take the first `n` items. * * @stable */ declare function take(source: AsyncIterable, n: number, signal?: AbortSignal): AsyncIterable; /** * Take items as long as `pred` returns truthy. The first item for which * `pred` returns falsy ends the stream. * * @stable */ declare function takeWhile(source: AsyncIterable, pred: (value: T, index: number) => boolean | Promise, signal?: AbortSignal): AsyncIterable; /** * Merge multiple async iterables into a single output iterable. Items * are yielded in the order they arrive (interleaved), not in source * order. Cancellation propagates to every upstream iterator. * * @stable */ declare function merge(sources: ReadonlyArray>, signal?: AbortSignal): AsyncIterable; /** * Wrap `source` with abort-signal propagation: when `signal` aborts the * underlying iterator's `return()` is called and the loop exits cleanly. * * @stable */ declare function withSignal(source: AsyncIterable, signal?: AbortSignal): AsyncIterable; //#endregion export { collect, filter, mapStream, merge, take, takeWhile, withSignal }; //# sourceMappingURL=streams.d.ts.map