@lumino/algorithm
Version:
Lumino Algorithms and Iterators
23 lines (22 loc) • 619 B
TypeScript
/**
* Iterate several iterables in lockstep.
*
* @param objects - The iterable objects of interest.
*
* @returns An iterator which yields successive tuples of values where
* each value is taken in turn from the provided iterables. It will
* be as long as the shortest provided iterable.
*
* #### Example
* ```typescript
* import { zip } from '@lumino/algorithm';
*
* let data1 = [1, 2, 3];
* let data2 = [4, 5, 6];
*
* let stream = zip(data1, data2);
*
* Array.from(stream); // [[1, 4], [2, 5], [3, 6]]
* ```
*/
export declare function zip<T>(...objects: Iterable<T>[]): IterableIterator<T[]>;