@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
1 lines • 1.47 kB
Source Map (JSON)
{"version":3,"sources":["iterable/operators/startwith.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,MAAM,OAAO,iBAA2B,SAAQ,SAAkB;IAIhE,YAAY,MAAyB,EAAE,IAAe;QACpD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE;YAC1B,MAAM,CAAC,CAAC;SACT;QACD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;YAC/B,MAAM,IAAI,CAAC;SACZ;IACH,CAAC;CACF;AAED,MAAM,UAAU,SAAS,CAAU,GAAG,IAAe;IACnD,OAAO,SAAS,yBAAyB,CAAC,MAAyB;QACjE,OAAO,IAAI,iBAAiB,CAAU,MAAM,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC,CAAC;AACJ,CAAC","file":"startwith.js","sourcesContent":["import { IterableX } from '../iterablex';\nimport { MonoTypeOperatorFunction } from '../../interfaces';\n\nexport class StartWithIterable<TSource> extends IterableX<TSource> {\n private _source: Iterable<TSource>;\n private _args: TSource[];\n\n constructor(source: Iterable<TSource>, args: TSource[]) {\n super();\n this._source = source;\n this._args = args;\n }\n\n *[Symbol.iterator]() {\n for (const x of this._args) {\n yield x;\n }\n for (const item of this._source) {\n yield item;\n }\n }\n}\n\nexport function startWith<TSource>(...args: TSource[]): MonoTypeOperatorFunction<TSource> {\n return function startWithOperatorFunction(source: Iterable<TSource>): IterableX<TSource> {\n return new StartWithIterable<TSource>(source, args);\n };\n}\n"]}