1 | import { IIterator, IterableOrArrayLike } from './iter';
|
2 | /**
|
3 | * Iterate several iterables in lockstep.
|
4 | *
|
5 | * @param objects - The iterable or array-like objects of interest.
|
6 | *
|
7 | * @returns An iterator which yields successive tuples of values where
|
8 | * each value is taken in turn from the provided iterables. It will
|
9 | * be as long as the shortest provided iterable.
|
10 | *
|
11 | * #### Example
|
12 | * ```typescript
|
13 | * import { zip, toArray } from '@lumino/algorithm';
|
14 | *
|
15 | * let data1 = [1, 2, 3];
|
16 | * let data2 = [4, 5, 6];
|
17 | *
|
18 | * let stream = zip(data1, data2);
|
19 | *
|
20 | * toArray(stream); // [[1, 4], [2, 5], [3, 6]]
|
21 | * ```
|
22 | */
|
23 | export declare function zip<T>(...objects: IterableOrArrayLike<T>[]): IIterator<T[]>;
|
24 | /**
|
25 | * An iterator which iterates several sources in lockstep.
|
26 | */
|
27 | export declare class ZipIterator<T> implements IIterator<T[]> {
|
28 | /**
|
29 | * Construct a new zip iterator.
|
30 | *
|
31 | * @param source - The iterators of interest.
|
32 | */
|
33 | constructor(source: IIterator<T>[]);
|
34 | /**
|
35 | * Get an iterator over the object's values.
|
36 | *
|
37 | * @returns An iterator which yields the object's values.
|
38 | */
|
39 | iter(): IIterator<T[]>;
|
40 | /**
|
41 | * Create an independent clone of the iterator.
|
42 | *
|
43 | * @returns A new independent clone of the iterator.
|
44 | */
|
45 | clone(): IIterator<T[]>;
|
46 | /**
|
47 | * Get the next value from the iterator.
|
48 | *
|
49 | * @returns The next value from the iterator, or `undefined`.
|
50 | */
|
51 | next(): T[] | undefined;
|
52 | private _source;
|
53 | }
|
54 | //# sourceMappingURL=zip.d.ts.map |
\ | No newline at end of file |