@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
1 lines • 2.82 kB
Source Map (JSON)
{"version":3,"sources":["asynciterable/operators/skip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,iBAA2B,SAAQ,cAAuB;IAIrE,YAAY,MAA8B,EAAE,KAAa;QACvD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,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,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACnD,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;QAC1C,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,IAAI,IAAI,CAAC;QACT,OAAO,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;YAClD,KAAK,EAAE,CAAC;SACT;QACD,IAAI,KAAK,IAAI,CAAC,EAAE;YACd,OAAO,CAAC,CAAC,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;gBACrC,MAAM,IAAI,CAAC,KAAK,CAAC;aAClB;SACF;IACH,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAAU,KAAa;IACzC,OAAO,SAAS,oBAAoB,CAAC,MAA8B;QACjE,OAAO,IAAI,iBAAiB,CAAU,MAAM,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC","file":"skip.js","sourcesContent":["import { AsyncIterableX } from '../asynciterablex';\nimport { MonoTypeOperatorAsyncFunction } from '../../interfaces';\nimport { wrapWithAbort } from './withabort';\nimport { throwIfAborted } from '../../aborterror';\n\nexport class SkipAsyncIterable<TSource> extends AsyncIterableX<TSource> {\n private _source: AsyncIterable<TSource>;\n private _count: number;\n\n constructor(source: AsyncIterable<TSource>, count: number) {\n super();\n this._source = source;\n this._count = count;\n }\n\n async *[Symbol.asyncIterator](signal?: AbortSignal) {\n throwIfAborted(signal);\n const source = wrapWithAbort(this._source, signal);\n const it = source[Symbol.asyncIterator]();\n let count = this._count;\n let next;\n while (count > 0 && !(next = await it.next()).done) {\n count--;\n }\n if (count <= 0) {\n while (!(next = await it.next()).done) {\n yield next.value;\n }\n }\n }\n}\n\n/**\n * Bypasses a specified number of elements in an async-iterable sequence and then returns the remaining elements.\n *\n * @export\n * @template TSource The type of the elements in the source sequence.\n * @param {number} count The number of elements to skip before returning the remaining elements.\n * @returns {MonoTypeOperatorAsyncFunction<TSource>} An async-iterable sequence that contains the elements that\n * occur after the specified index in the input sequence.\n */\nexport function skip<TSource>(count: number): MonoTypeOperatorAsyncFunction<TSource> {\n return function skipOperatorFunction(source: AsyncIterable<TSource>): AsyncIterableX<TSource> {\n return new SkipAsyncIterable<TSource>(source, count);\n };\n}\n"]}