most-range
v0.0.11
Published
Create ranges of integers as most.js streams
Downloads
2
Maintainers
Readme
most-range
Creates a most.js stream of numbers (positive and/or negative) progressing from start up, or down, to, but not including, end.
Installation
Using npm:
$ npm install --save most-range
In Node.js:
const range = require('most-range');
Usage
range(start, end [, step = 1 or -1]) -> Stream
range(0, 10, 2): -0-2-4-6-8-|
start
is the start of the range.end
is the end of the range, its value is excluded.step
is the value to increment or decrement by, the default is 1 ifend
is greater thanstart
, -1 otherwise.
Example
const range = require('most-range');
// Logs
// 10
// 7
// 4
// 1
range(10, 0, -3)
.observe(x => console.log(x))