UNPKG

1.36 kBSource Map (JSON)View Raw
1{"version":3,"sources":["asynciterable/startwith.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,sBAAgC,SAAQ,cAAuB;IAI1E,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,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE;YACxB,MAAM,CAAC,CAAC;SACT;QACD,IAAI,KAAK,EAAE,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;YACnC,MAAM,IAAI,CAAC;SACZ;IACH,CAAC;CACF;AAED,MAAM,UAAU,SAAS,CACvB,MAA8B,EAC9B,GAAG,IAAe;IAElB,OAAO,IAAI,sBAAsB,CAAU,MAAM,EAAE,IAAI,CAAC,CAAC;AAC3D,CAAC","file":"startwith.js","sourcesContent":["import { AsyncIterableX } from './asynciterablex';\n\nexport class StartWithAsyncIterable<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 (let x of this._args) {\n yield x;\n }\n for await (let item of this._source) {\n yield item;\n }\n }\n}\n\nexport function startWith<TSource>(\n source: AsyncIterable<TSource>,\n ...args: TSource[]\n): AsyncIterableX<TSource> {\n return new StartWithAsyncIterable<TSource>(source, args);\n}\n"]}
\No newline at end of file