js-range

1.0.0 • Public • Published

npm Build Status

js-range

A function to generate an array sequence of numbers from start (inclusive) to end (exclusive), by step, where start and end defaults to 0, and step to 1. When start is equal to end, returns empty list. Similar to Clojure's range, but without laziness.

Installation

npm i -S js-range

Usage

import range from 'js-range';
 
range(5, 8); // [5, 6, 7]
range(5, 10, 2); // [5, 7, 9]
range(10, 5); // [10, 9, 8, 7, 6]
range(3, -10, -3) // [3, 0, -3, -6, -9]

Readme

Keywords

Package Sidebar

Install

npm i js-range

Weekly Downloads

100

Version

1.0.0

License

MIT

Last publish

Collaborators

  • roman01la