@lumino/algorithm
Version:
Lumino Algorithms and Iterators
29 lines (28 loc) • 767 B
TypeScript
/**
* Create an iterator of evenly spaced values.
*
* @param start - The starting value for the range, inclusive.
*
* @param stop - The stopping value for the range, exclusive.
*
* @param step - The distance between each value.
*
* @returns An iterator which produces evenly spaced values.
*
* #### Notes
* In the single argument form of `range(stop)`, `start` defaults to
* `0` and `step` defaults to `1`.
*
* In the two argument form of `range(start, stop)`, `step` defaults
* to `1`.
*
* #### Example
* ```typescript
* import { range } from '@lumino/algorithm';
*
* let stream = range(2, 4);
*
* Array.from(stream); // [2, 3]
* ```
*/
export declare function range(start: number, stop?: number, step?: number): IterableIterator<number>;