UNPKG

1.5 kBSource Map (JSON)View Raw
1{"version":3,"sources":["asynciterable/of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,OAAO,eAAyB,SAAQ,cAAuB;IAGnE,YAAY,IAAe;QACzB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAoB;QAChD,cAAc,CAAC,MAAM,CAAC,CAAC;QACvB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YAC7B,MAAM,IAAI,CAAC;SACZ;IACH,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,EAAE,CAAU,GAAG,IAAe;IAC5C,OAAO,IAAI,eAAe,CAAU,IAAI,CAAC,CAAC;AAC5C,CAAC","file":"of.js","sourcesContent":["import { AsyncIterableX } from './asynciterablex';\nimport { throwIfAborted } from '../aborterror';\n\nexport class OfAsyncIterable<TSource> extends AsyncIterableX<TSource> {\n private _args: TSource[];\n\n constructor(args: TSource[]) {\n super();\n this._args = args;\n }\n\n async *[Symbol.asyncIterator](signal?: AbortSignal) {\n throwIfAborted(signal);\n for (const item of this._args) {\n yield item;\n }\n }\n}\n\n/**\n * Creates an async-iterable from the specified elements.\n *\n * @export\n * @template TSource The type of the elements to create an async-iterable sequence.\n * @param {...TSource[]} args The elements to turn into an async-iterable sequence.\n * @returns {AsyncIterableX<TSource>} The async-iterable sequence created from the elements.\n */\nexport function of<TSource>(...args: TSource[]): AsyncIterableX<TSource> {\n return new OfAsyncIterable<TSource>(args);\n}\n"]}
\No newline at end of file