UNPKG

@reactivex/ix-esnext-esm

Version:

The Interactive Extensions for JavaScript

1 lines 1.32 kB
{"version":3,"sources":["iterable/operators/retry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC;;;;;;;;GAQG;AACH,MAAM,UAAU,KAAK,CAAU,QAAgB,CAAC,CAAC;IAC/C,OAAO,SAAS,qBAAqB,CAAC,MAAyB;QAC7D,OAAO,QAAQ,CAAU,WAAW,CAAoB,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAC1E,CAAC,CAAC;AACJ,CAAC","file":"retry.js","sourcesContent":["import { IterableX } from '../iterablex';\nimport { repeatValue } from '../repeatvalue';\nimport { catchAll } from '../catcherror';\nimport { MonoTypeOperatorFunction } from '../../interfaces';\n\n/**\n * Retries the iterable instance the number of given times. If not supplied, it will try infinitely.\n *\n * @export\n * @template TSource The type of the elements in the source sequence.\n * @param {number} [count=-1] An optional number of times to retry, otherwise is set to infinite retries\n * @returns {MonoTypeOperatorAsyncFunction<TSource>} An iterable sequence producing the elements of the\n * given sequence repeatedly until it terminates successfully.\n */\nexport function retry<TSource>(count: number = -1): MonoTypeOperatorFunction<TSource> {\n return function retryOperatorFunction(source: Iterable<TSource>): IterableX<TSource> {\n return catchAll<TSource>(repeatValue<Iterable<TSource>>(source, count));\n };\n}\n"]}