Range Life
A range utility that no one asked for.
Supports stepped ranges of integers, decimals, letters, and even a supplied array of values.
"If I had a range life, then I could settle down." - Stephen Malkmus
Installation
$ npm install range-life
Usage
Inclusion
All examples are supported by the default module.
However, you may submodule for specific methods like so.
Examples
// => [] // => [0, 1, 2, 3] // => [0, -1, -2, -3] // => [1, 2, 3, 4] // => [0, 5, 10, 15] // => [0, -1, -2, -3] // => [1, 1, 1] // => [1, 1.5, 2, 2.5, 3, 3.5] // letters are inclusive // => ['a', 'b', 'c', 'd', 'e'] // => ['A', 'B', 'C', 'D', 'E'] // => ['A', 'C', 'E'] // values are exclusiveconst values = 'Zero' 'One' 'Two' 'Three' // => ['Zero', 'One', 'Two'] // => ['Zero', 'Two']
API Reference
range-life/standard
Parameters
Examples
// => [1, 2, 3, 4] // => [0, 5, 10, 15]
range-life/alpha
Parameters
Examples
// => ['A', 'B', 'C', 'D', 'E'] // => ['A', 'C', 'E']
range-life/values
Parameters
Examples
const values = 'Zero' 'One' 'Two' 'Three' // => ['One', 'Two'] // => ['Zero', 'Two']
Returns Array<any>