UNPKG

1.8 kBSource Map (JSON)View Raw
1{"version":3,"sources":["asynciterable/range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,kBAAmB,SAAQ,cAAsB;IAIrD,YAAY,KAAa,EAAE,KAAa;QACtC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAoB;QAChD,cAAc,CAAC,MAAM,CAAC,CAAC;QACvB,KAAK,IAAI,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,GAAG,EAAE,OAAO,EAAE,EAAE;YACzF,MAAM,OAAO,CAAC;SACf;IACH,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,KAAa;IAChD,OAAO,IAAI,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC","file":"range.js","sourcesContent":["import { AsyncIterableX } from './asynciterablex';\nimport { throwIfAborted } from '../aborterror';\n\nclass RangeAsyncIterable extends AsyncIterableX<number> {\n private _start: number;\n private _count: number;\n\n constructor(start: number, count: number) {\n super();\n this._start = start;\n this._count = count;\n }\n\n async *[Symbol.asyncIterator](signal?: AbortSignal) {\n throwIfAborted(signal);\n for (let current = this._start, end = this._start + this._count; current < end; current++) {\n yield current;\n }\n }\n}\n\n/**\n * Generates an async-iterable sequence of integral numbers within a specified range.\n *\n * @export\n * @param {number} start The value of the first integer in the sequence.\n * @param {number} count The number of sequential integers to generate.\n * @returns {AsyncIterableX<number>} An async-iterable sequence that contains a range of sequential integral numbers.\n */\nexport function range(start: number, count: number): AsyncIterableX<number> {\n return new RangeAsyncIterable(start, count);\n}\n"]}
\No newline at end of file