@lumino/algorithm
Version:
Lumino Algorithms and Iterators
23 lines (22 loc) • 610 B
TypeScript
/**
* Iterate over an iterable using a stepped increment.
*
* @param object - The iterable object of interest.
*
* @param step - The distance to step on each iteration. A value
* of less than `1` will behave the same as a value of `1`.
*
* @returns An iterator which traverses the iterable step-wise.
*
* #### Example
* ```typescript
* import { stride } from '@lumino/algorithm';
*
* let data = [1, 2, 3, 4, 5, 6];
*
* let stream = stride(data, 2);
*
* Array.from(stream); // [1, 3, 5];
* ```
*/
export declare function stride<T>(object: Iterable<T>, step: number): IterableIterator<T>;