UNPKG

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