UNPKG

7.34 kBSource Map (JSON)View Raw
1{"version":3,"sources":["iterable/zip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,OAAO,WAAqB,SAAQ,SAAoB;IAG5D,YAAY,OAA4B;QACtC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IACD,6CAA6C;IAC7C,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC3D,OAAO,aAAa,GAAG,CAAC,EAAE;YACxB,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;YACxC,KAAK,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,GAAG,aAAa,GAAI;gBAC9C,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;gBACjC,IAAI,MAAM,CAAC,IAAI,EAAE;oBACf,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;oBAC5B,OAAO,SAAS,CAAC;iBAClB;gBACD,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;aAC9B;YACD,MAAM,MAAM,CAAC;SACd;IACH,CAAC;CACF;AA6GD,MAAM,UAAU,GAAG,CAAI,GAAG,OAAc;IACtC,OAAO,IAAI,WAAW,CAAI,OAAO,CAAC,CAAC;AACrC,CAAC","file":"zip.js","sourcesContent":["import { IterableX } from './iterablex';\nimport { returnIterator } from '../util/returniterator';\n\nexport class ZipIterable<TSource> extends IterableX<TSource[]> {\n private _sources: Iterable<TSource>[];\n\n constructor(sources: Iterable<TSource>[]) {\n super();\n this._sources = sources;\n }\n // eslint-disable-next-line consistent-return\n *[Symbol.iterator](): IterableIterator<TSource[]> {\n const sourcesLength = this._sources.length;\n const its = this._sources.map((x) => x[Symbol.iterator]());\n while (sourcesLength > 0) {\n const values = new Array(sourcesLength);\n for (let index = -1; ++index < sourcesLength; ) {\n const result = its[index].next();\n if (result.done) {\n its.forEach(returnIterator);\n return undefined;\n }\n values[index] = result.value;\n }\n yield values;\n }\n }\n}\n\n/**\n * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion.\n *\n * @export\n * @template T The type of the first async-iterable sequence.\n * @template T2 The type of the second async-iterable sequence.\n * @param {Iterable<T>} source The first async-iterable source.\n * @param {Iterable<T2>} source2 The second async-iterable source.\n * @returns {IterableX<[T, T2]>} Async iterable with an array of each element from the source sequences in a pairwise fashion.\n */\nexport function zip<T, T2>(source: Iterable<T>, source2: Iterable<T2>): IterableX<[T, T2]>;\n/**\n * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion.\n *\n * @export\n * @template T The type of the first async-iterable sequence.\n * @template T2 The type of the second async-iterable sequence.\n * @template T3 The type of the third async-iterable sequence.\n * @param {Iterable<T>} source The first async-iterable source.\n * @param {Iterable<T2>} source2 The second async-iterable source.\n * @param {Iterable<T3>} source3 The third async-iterable source.\n * @returns {IterableX<[T, T2, T3]>} Async iterable with an array of each element from the source sequences in a pairwise fashion.\n */\nexport function zip<T, T2, T3>(\n source: Iterable<T>,\n source2: Iterable<T2>,\n source3: Iterable<T3>\n): IterableX<[T, T2, T3]>;\n/**\n * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion.\n *\n * @export\n * @template T The type of the first async-iterable sequence.\n * @template T2 The type of the second async-iterable sequence.\n * @template T3 The type of the third async-iterable sequence.\n * @template T4 The type of the fourth async-iterable sequence.\n * @param {Iterable<T>} source The first async-iterable source.\n * @param {Iterable<T2>} source2 The second async-iterable source.\n * @param {Iterable<T3>} source3 The third async-iterable source.\n * @param {Iterable<T4>} source4 The fourth async-iterable source.\n * @returns {IterableX<[T, T2, T3, T4]>} Async iterable with an array of each element from the source sequences in a pairwise fashion.\n */\nexport function zip<T, T2, T3, T4>(\n source: Iterable<T>,\n source2: Iterable<T2>,\n source3: Iterable<T3>,\n source4: Iterable<T4>\n): IterableX<[T, T2, T3, T4]>;\n/**\n * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion.\n *\n * @export\n * @template T The type of the first async-iterable sequence.\n * @template T2 The type of the second async-iterable sequence.\n * @template T3 The type of the third async-iterable sequence.\n * @template T4 The type of the fourth async-iterable sequence.\n * @template T5 The type of the fifth async-iterable sequence.\n * @param {Iterable<T>} source The first async-iterable source.\n * @param {Iterable<T2>} source2 The second async-iterable source.\n * @param {Iterable<T3>} source3 The third async-iterable source.\n * @param {Iterable<T4>} source4 The fourth async-iterable source.\n * @param {Iterable<T5>} source5 The fifth async-iterable source.\n * @returns {IterableX<[T, T2, T3, T4, T5]>} Async iterable with an array of each element from the source sequences in a pairwise fashion.\n */\nexport function zip<T, T2, T3, T4, T5>(\n source: Iterable<T>,\n source2: Iterable<T2>,\n source3: Iterable<T3>,\n source4: Iterable<T4>,\n source5: Iterable<T5>\n): IterableX<[T, T2, T3, T4, T5]>;\n/**\n * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion.\n *\n * @export\n * @template T The type of the first async-iterable sequence.\n * @template T2 The type of the second async-iterable sequence.\n * @template T3 The type of the third async-iterable sequence.\n * @template T4 The type of the fourth async-iterable sequence.\n * @template T5 The type of the fifth async-iterable sequence.\n * @template T6 The type of the sixth async-iterable sequence.\n * @param {Iterable<T>} source The first async-iterable source.\n * @param {Iterable<T2>} source2 The second async-iterable source.\n * @param {Iterable<T3>} source3 The third async-iterable source.\n * @param {Iterable<T4>} source4 The fourth async-iterable source.\n * @param {Iterable<T5>} source5 The fifth async-iterable source.\n * @param {Iterable<T6>} source6 The sixth async-iterable source.\n * @returns {IterableX<[T, T2, T3, T4, T5, T6]>} Async iterable with an array of each element from the source sequences in a pairwise fashion.\n */\nexport function zip<T, T2, T3, T4, T5, T6>(\n source: Iterable<T>,\n source2: Iterable<T2>,\n source3: Iterable<T3>,\n source4: Iterable<T4>,\n source5: Iterable<T5>,\n source6: Iterable<T6>\n): IterableX<[T, T2, T3, T4, T5, T6]>;\n\n/**\n * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion.\n *\n * @export\n * @template T The type of elements in the source sequences.\n * @param {...Iterable<T>[]} sources The source sequences.\n * @returns {IterableX<T[]>} Async iterable with an array of each element from the source sequences in a pairwise fashion.\n */\nexport function zip<T>(...sources: Iterable<T>[]): IterableX<T[]>;\nexport function zip<T>(...sources: any[]): IterableX<T[]> {\n return new ZipIterable<T>(sources);\n}\n"]}
\No newline at end of file