UNPKG

@reactivex/ix-esnext-esm

Version:

The Interactive Extensions for JavaScript

1 lines 1.37 kB
{"version":3,"sources":["asynciterable/operators/dowhile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CACrB,SAA+D;IAE/D,OAAO,SAAS,uBAAuB,CAAC,MAA8B;QACpE,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACpD,CAAC,CAAC;AACJ,CAAC","file":"dowhile.js","sourcesContent":["import { AsyncIterableX } from '../asynciterablex';\nimport { concat } from '../concat';\nimport { whileDo } from '../whiledo';\nimport { MonoTypeOperatorAsyncFunction } from '../../interfaces';\n\n/**\n * Generates an async-iterable sequence by repeating a source sequence as long as the given loop postcondition holds.\n *\n * @export\n * @template TSource The type of elements in the source sequence.\n * @param {((signal?: AbortSignal) => boolean | Promise<boolean>)} condition Loop condition.\n * @returns {MonoTypeOperatorAsyncFunction<TSource>} An operator that generates an async-iterable by repeating a\n * source sequence while the postcondition holds.\n */\nexport function doWhile<TSource>(\n condition: (signal?: AbortSignal) => boolean | Promise<boolean>\n): MonoTypeOperatorAsyncFunction<TSource> {\n return function doWhileOperatorFunction(source: AsyncIterable<TSource>): AsyncIterableX<TSource> {\n return concat(source, whileDo(source, condition));\n };\n}\n"]}