UNPKG

610 BTypeScriptView Raw
1/**
2 * Iterate over an iterable using a stepped increment.
3 *
4 * @param object - The iterable object of interest.
5 *
6 * @param step - The distance to step on each iteration. A value
7 * of less than `1` will behave the same as a value of `1`.
8 *
9 * @returns An iterator which traverses the iterable step-wise.
10 *
11 * #### Example
12 * ```typescript
13 * import { stride } from '@lumino/algorithm';
14 *
15 * let data = [1, 2, 3, 4, 5, 6];
16 *
17 * let stream = stride(data, 2);
18 *
19 * Array.from(stream); // [1, 3, 5];
20 * ```
21 */
22export declare function stride<T>(object: Iterable<T>, step: number): IterableIterator<T>;