@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
1 lines • 1.57 kB
Source Map (JSON)
{"version":3,"sources":["asynciterable/operators/endwith.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,MAAM,OAAO,oBAA8B,SAAQ,cAAuB;IAIxE,YAAY,MAA8B,EAAE,IAAe;QACzD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QAC3B,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;YACrC,MAAM,IAAI,CAAC;SACZ;QACD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE;YAC1B,MAAM,CAAC,CAAC;SACT;IACH,CAAC;CACF;AAED,MAAM,UAAU,OAAO,CAAU,GAAG,IAAe;IACjD,OAAO,SAAS,wBAAwB,CACtC,MAA8B;QAE9B,OAAO,IAAI,oBAAoB,CAAU,MAAM,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC,CAAC;AACJ,CAAC","file":"endwith.js","sourcesContent":["import { AsyncIterableX } from '../asynciterablex';\nimport { MonoTypeOperatorAsyncFunction } from '../../interfaces';\n\nexport class EndWithAsyncIterable<TSource> extends AsyncIterableX<TSource> {\n private _source: AsyncIterable<TSource>;\n private _args: TSource[];\n\n constructor(source: AsyncIterable<TSource>, args: TSource[]) {\n super();\n this._source = source;\n this._args = args;\n }\n\n async *[Symbol.asyncIterator]() {\n for await (const item of this._source) {\n yield item;\n }\n for (const x of this._args) {\n yield x;\n }\n }\n}\n\nexport function endWith<TSource>(...args: TSource[]): MonoTypeOperatorAsyncFunction<TSource> {\n return function endsWithOperatorFunction(\n source: AsyncIterable<TSource>\n ): AsyncIterableX<TSource> {\n return new EndWithAsyncIterable<TSource>(source, args);\n };\n}\n"]}