UNPKG

1.19 kBSource Map (JSON)View Raw
1{"version":3,"sources":["iterable/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,iBAAqB,SAAQ,SAAY;IAG7C,YAAY,EAAqB;QAC/B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IAChB,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QACf,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,MAAM,CAAI,WAA8B;IACtD,OAAO,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAC5C,CAAC","file":"create.js","sourcesContent":["import { IterableX } from './iterablex';\n\nclass AnonymousIterable<T> extends IterableX<T> {\n private _fn: () => Iterator<T>;\n\n constructor(fn: () => Iterator<T>) {\n super();\n this._fn = fn;\n }\n\n [Symbol.iterator]() {\n return this._fn();\n }\n}\n\n/**\n * Creates a new iterable using the specified function implementing the members of AsyncIterable\n *\n * @export\n * @template T The type of the elements returned by the iterable sequence.\n * @param {(() => Iterator<T>)} fn The function that creates the [Symbol.iterator]() method\n * @returns {IterableX<T>} A new iterable instance.\n */\nexport function create<T>(getIterator: () => Iterator<T>): IterableX<T> {\n return new AnonymousIterable(getIterator);\n}\n"]}
\No newline at end of file