UNPKG

@reactivex/ix-esnext-esm

Version:

The Interactive Extensions for JavaScript

34 lines (32 loc) 1.11 kB
import { AsyncIterableX } from '../asynciterablex.js'; import { wrapWithAbort } from './withabort.js'; import { throwIfAborted } from '../../aborterror.js'; /** @ignore */ export class ConcatAllAsyncIterable extends AsyncIterableX { _source; constructor(source) { super(); this._source = source; } async *[Symbol.asyncIterator](signal) { throwIfAborted(signal); for await (const outer of wrapWithAbort(this._source, signal)) { for await (const item of wrapWithAbort(outer, signal)) { yield item; } } } } /** * Concatenates all inner async-iterable sequences, as long as the previous * async-iterable sequence terminated successfully. * * @template T The type of elements in the source sequence. * @returns {OperatorAsyncFunction<AsyncIterable<T>, T>} An operator which concatenates all inner async-iterable sources. */ export function concatAll() { return function concatAllOperatorFunction(source) { return new ConcatAllAsyncIterable(source); }; } //# sourceMappingURL=concatall.js.map