UNPKG

1.17 kBSource Map (JSON)View Raw
1{"version":3,"sources":["iterable/whiledo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,aAAuB,SAAQ,SAAkB;IAIrD,YAAY,SAAwB,EAAE,MAAyB;QAC7D,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,OAAO,IAAI,CAAC,UAAU,EAAE,EAAE;YACxB,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;SACrB;IACH,CAAC;CACF;AAED,MAAM,UAAU,OAAO,CACrB,SAAwB,EACxB,MAAyB;IAEzB,OAAO,IAAI,aAAa,CAAU,SAAS,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC","file":"whiledo.js","sourcesContent":["import { IterableX } from './iterablex';\n\nclass WhileIterable<TSource> extends IterableX<TSource> {\n private _condition: () => boolean;\n private _source: Iterable<TSource>;\n\n constructor(condition: () => boolean, source: Iterable<TSource>) {\n super();\n this._condition = condition;\n this._source = source;\n }\n\n *[Symbol.iterator]() {\n while (this._condition()) {\n yield* this._source;\n }\n }\n}\n\nexport function whileDo<TSource>(\n condition: () => boolean,\n source: Iterable<TSource>\n): IterableX<TSource> {\n return new WhileIterable<TSource>(condition, source);\n}\n"]}
\No newline at end of file