Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.3 KB

Readme.md

File metadata and controls

47 lines (31 loc) · 1.3 KB

range

Build status Git tag NPM version Code style

Generate a range of numbers with a given (optional) step size

Installation

$ npm install @f/range

Usage

var range = require('@f/range')


range(4)        // -> [0, 1, 2, 3]
range(1, 4)     // -> [1, 2, 3]
range(4, 1, -1) // -> [4, 3, 2]

API

range(start, end, step)

  • start - Start of the sequence. If you pass only one argument, this is taken as the end, and the implied start is 0.
  • 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.

License

MIT