Returns a Seq.Indexed of numbers from start
(inclusive) to end
(exclusive), by step
, where start
defaults to 0, step
to 1, and end
to
infinity. When start
is equal to end
, returns empty range.
Range(start: number, end: number, step?: number): Seq.Indexed<number>
Note: Range
is a factory function and not a class, and does not use the
new
keyword during construction.
const { Range } = require('immutable')
Range() // [ 0, 1, 2, 3, ... ]
Range(10) // [ 10, 11, 12, 13, ... ]
Range(10, 15) // [ 10, 11, 12, 13, 14 ]
Range(10, 30, 5) // [ 10, 15, 20, 25 ]
Range(30, 10, 5) // [ 30, 25, 20, 15 ]
Range(30, 30, 5) // []