Generate a range of numbers with a given (optional) step size
$ npm install @f/range
var range = require('@f/range')
range(4) // -> [0, 1, 2, 3]
range(1, 4) // -> [1, 2, 3]
range(4, 1, -1) // -> [4, 3, 2]
start
- Start of the sequence. If you pass only one argument, this is taken as the end, and the implied start is0
.end
- End of the sequence.step
- Step size. Optional, defaults to 1.
Returns: An array of the range of values between start
and end
, in increments of step
size.
MIT