natural-range
Convert any range to an exclusive range in natural order.
Installation
npm install natural-range
Example
var assert = ;var Range = ; var range = from: 3 to: 1 ; assert;assert;assert;
See test/test.js
for more examples.
API
var range = options;
-
options
- an object literal supports these options:from
- the start numberto
- the end numberexclusive
- a boolean denoting if the range is exclusivelength
- iffrom
orto
is negative, and this option is provided, the negative number means backwards indexing and is relative tolength
-
range
- the range object in natural order containing these properties:from
- the start numberto
- the end numberreversed
- a boolean denoting if the original range is in reversed order