Skip to content

micro-js/range

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published