Skip to content

Commit 2cce5db

Browse files
committed
Document
1 parent ca998e6 commit 2cce5db

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://travis-ci.org/smikitky/node-multi-integer-range.svg?branch=master)](https://travis-ci.org/smikitky/node-multi-integer-range)
44

5-
A small library which parses and manipulates comma-delimited positive integer ranges (such as "1-3,8-10").
5+
A small library which parses and manipulates comma-delimited integer ranges (such as "1-3,8-10").
66

77
Such strings are typically used in print dialogs to indicate which pages to print.
88

@@ -115,6 +115,17 @@ The following methods are deprecated and may be removed in future releases:
115115
- `hasRange(min: number, max: number): boolean` Use `has([[min, max]])` instead.
116116
- `isContinuous(): boolean` Use `segmentLength() === 1` instead.
117117

118+
### Negative ranges
119+
120+
You can handle ranges containing zero or negative integers.
121+
To pass negative integers to the string parser, always contain them in parentheses.
122+
123+
```js
124+
var mr1 = new MultiRange('(-5),(-1)-0');
125+
mr1.append([[-4, -2]]); // -4 to -2
126+
console.log(mr1 + ''); // prints '(-5)-0'
127+
```
128+
118129
### Iteration
119130

120131
**ES6 iterator**: If `Symbol.iterator` is defined in the runtime,

0 commit comments

Comments
 (0)