UNPKG

7.39 kBSource Map (JSON)View Raw
1{"version":3,"sources":["asynciterable/concat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,OAAO,mBAA6B,SAAQ,cAAuB;IAGvE,YAAY,MAAwC;QAClD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAoB;QAChD,cAAc,CAAC,MAAM,CAAC,CAAC;QACvB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE;YAChC,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;gBACrD,MAAM,IAAI,CAAC;aACZ;SACF;IACH,CAAC;CACF;AAED,MAAM,UAAU,UAAU,CACxB,MAAwC;IAExC,OAAO,IAAI,mBAAmB,CAAU,MAAM,CAAC,CAAC;AAClD,CAAC;AA2GD;;;;;;;;GAQG;AACH,MAAM,UAAU,MAAM,CAAI,GAAG,IAAwB;IACnD,OAAO,IAAI,mBAAmB,CAAI,IAAI,CAAC,CAAC;AAC1C,CAAC","file":"concat.js","sourcesContent":["import { AsyncIterableX } from './asynciterablex';\nimport { wrapWithAbort } from './operators/withabort';\nimport { throwIfAborted } from '../aborterror';\n\nexport class ConcatAsyncIterable<TSource> extends AsyncIterableX<TSource> {\n private _source: Iterable<AsyncIterable<TSource>>;\n\n constructor(source: Iterable<AsyncIterable<TSource>>) {\n super();\n this._source = source;\n }\n\n async *[Symbol.asyncIterator](signal?: AbortSignal) {\n throwIfAborted(signal);\n for (const outer of this._source) {\n for await (const item of wrapWithAbort(outer, signal)) {\n yield item;\n }\n }\n }\n}\n\nexport function _concatAll<TSource>(\n source: Iterable<AsyncIterable<TSource>>\n): AsyncIterableX<TSource> {\n return new ConcatAsyncIterable<TSource>(source);\n}\n\n/**\n * Concatenates the second async-iterable sequence to the first async-iterable sequence upon successful termination of the first.\n *\n * @export\n * @template T The type of the elements in the first source sequence.\n * @template T2 The type of the elements in the second source sequence.\n * @param {AsyncIterable<T>} v1 First async-iterable source.\n * @param {AsyncIterable<T2>} v2 Second async-iterable source.\n * @returns {(AsyncIterableX<T | T2>)} An async-iterable sequence that contains the elements of the first sequence,\n * followed by those of the second the sequence.\n */\nexport function concat<T, T2>(v1: AsyncIterable<T>, v2: AsyncIterable<T2>): AsyncIterableX<T | T2>;\n/**\n * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable\n * sequence terminated successfully.\n *\n * @export\n * @template T The type of the elements in the first source sequence.\n * @template T2 The type of the elements in the second source sequence.\n * @template T3 The type of the elements in the third source sequence.\n * @param {AsyncIterable<T>} v1 First async-iterable source.\n * @param {AsyncIterable<T2>} v2 Second async-iterable source.\n * @param {AsyncIterable<T3>} v3 Third async-iterable source.\n * @returns {(AsyncIterableX<T | T2 | T3>)} An async-iterable sequence that contains the elements of each given sequence, in sequential order.\n */\nexport function concat<T, T2, T3>(\n v1: AsyncIterable<T>,\n v2: AsyncIterable<T2>,\n v3: AsyncIterable<T3>\n): AsyncIterableX<T | T2 | T3>;\n/**\n * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable\n * sequence terminated successfully.\n *\n * @export\n * @template T The type of the elements in the first source sequence.\n * @template T2 The type of the elements in the second source sequence.\n * @template T3 The type of the elements in the third source sequence.\n * @template T4 The type of the elements in the fourth source sequence.\n * @param {AsyncIterable<T>} v1 First async-iterable source.\n * @param {AsyncIterable<T2>} v2 Second async-iterable source.\n * @param {AsyncIterable<T3>} v3 Third async-iterable source.\n * @param {AsyncIterable<T4>} v4 Fourth async-iterable source.\n * @returns {(AsyncIterableX<T | T2 | T3 | T4>)} An async-iterable sequence that contains the elements of each given sequence, in sequential order.\n */\nexport function concat<T, T2, T3, T4>(\n v1: AsyncIterable<T>,\n v2: AsyncIterable<T2>,\n v3: AsyncIterable<T3>,\n v4: AsyncIterable<T4>\n): AsyncIterableX<T | T2 | T3 | T4>;\n/**\n * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable\n * sequence terminated successfully.\n *\n * @export\n * @template T The type of the elements in the first source sequence.\n * @template T2 The type of the elements in the second source sequence.\n * @template T3 The type of the elements in the third source sequence.\n * @template T4 The type of the elements in the fourth source sequence.\n * @template T5 The type of the elements in the fifth source sequence.\n * @param {AsyncIterable<T>} v1 First async-iterable source.\n * @param {AsyncIterable<T2>} v2 Second async-iterable source.\n * @param {AsyncIterable<T3>} v3 Third async-iterable source.\n * @param {AsyncIterable<T4>} v4 Fourth async-iterable source.\n * @param {AsyncIterable<T5>} v5 Fifth async-iterable source.\n * @returns {(AsyncIterable<T | T2 | T3 | T4 | T5>)} An async-iterable sequence that contains the elements of each\n * given sequence, in sequential order.\n */\nexport function concat<T, T2, T3, T4, T5>(\n v1: AsyncIterable<T>,\n v2: AsyncIterable<T2>,\n v3: AsyncIterable<T3>,\n v4: AsyncIterable<T4>,\n v5: AsyncIterable<T5>\n): AsyncIterable<T | T2 | T3 | T4 | T5>;\n/**\n * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable\n * sequence terminated successfully.\n *\n * @export\n * @template T The type of the elements in the first source sequence.\n * @template T2 The type of the elements in the second source sequence.\n * @template T3 The type of the elements in the third source sequence.\n * @template T4 The type of the elements in the fourth source sequence.\n * @template T5 The type of the elements in the fifth source sequence.\n * @template T6 The type of the elements in the sixth source sequence.\n * @param {AsyncIterable<T>} v1 First async-iterable source.\n * @param {AsyncIterable<T2>} v2 Second async-iterable source.\n * @param {AsyncIterable<T3>} v3 Third async-iterable source.\n * @param {AsyncIterable<T4>} v4 Fourth async-iterable source.\n * @param {AsyncIterable<T5>} v5 Fifth async-iterable source.\n * @param {AsyncIterable<T6>} v6 Sixth async-iterable source.\n * @returns {(AsyncIterable<T | T2 | T3 | T4 | T5 | T6>)} An async-iterable sequence that contains the elements of each\n * given sequence, in sequential order.\n */\nexport function concat<T, T2, T3, T4, T5, T6>(\n v1: AsyncIterable<T>,\n v2: AsyncIterable<T2>,\n v3: AsyncIterable<T3>,\n v4: AsyncIterable<T4>,\n v5: AsyncIterable<T5>,\n v6: AsyncIterable<T6>\n): AsyncIterable<T | T2 | T3 | T4 | T5 | T6>;\n\n/**\n * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable\n * sequence terminated successfully.\n *\n * @export\n * @template T The type of the elements in the sequences.\n * @param {...AsyncIterable<T>[]} args The async-iterable sources.\n * @returns {AsyncIterableX<T>} An async-iterable sequence that contains the elements of each given sequence, in sequential order.\n */\nexport function concat<T>(...args: AsyncIterable<T>[]): AsyncIterableX<T> {\n return new ConcatAsyncIterable<T>(args);\n}\n"]}
\No newline at end of file