Skip to content

Commit 7ed7283

Browse files
committed
Doc
1 parent 6a9b570 commit 7ed7283

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
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

55
A small library which parses and manipulates comma-delimited integer ranges (such as "1-3,8-10").
6-
76
Such strings are typically used in print dialogs to indicate which pages to print.
87

98
Supported operations include:
@@ -119,21 +118,22 @@ The following methods are deprecated and may be removed in future releases:
119118

120119
### Unbounded ranges
121120

122-
Starting from version 2.1, you can use unbounded (or infinite) ranges which look like this:
121+
Starting from version 2.1, you can use unbounded (or infinite) ranges,
122+
which look like this:
123123

124124
```js
125125
// using the string parser...
126126
var unbounded1 = new MultiRange('5-'); // all integers >= 5
127127
var unbounded2 = new MultiRange('-3'); // all integers <= 3
128128
var unbounded3 = new MultiRange('-'); // all integers
129129

130-
// or programatically, using the JavaScript constant `Infinity`...
130+
// or programmatically, using the JavaScript constant `Infinity`...
131131
var unbounded4 = new MultiRange([[5, Infinity]]); // all integers >= 5
132132
var unbounded5 = new MultiRange([[-Infinity, 3]]); // all integers <= 3
133133
var unbounded6 = new MultiRange([[-Infinity, Infinity]]); // all integers
134134
```
135135

136-
The manipulation methods should work just as expected:
136+
The manipulation methods work just as expected with unbounded ranges:
137137

138138
```js
139139
console.log(multirange('5-10,15-').append('0,11-14') + ''); // '0,5-'
@@ -144,11 +144,11 @@ console.log(multirange('-5,10-').has('-3,20')); // true
144144
var userInput = '-10,15-20,90-';
145145
var pagesInMyDoc = '1-100';
146146
var pagesToPrint = multirange(userInput).intersect(pagesInMyDoc);
147-
console.log(pagesToPrint);
148-
// prints '1-10,15-20,90-100'
147+
console.log(pagesToPrint); // prints '1-10,15-20,90-100'
149148
```
150149

151-
Unbounded ranges cannot be iterated over, and you cannot call `#toArray()` for the obvious reason. Calling `#length()` for unbounded ranges will return `Infinity`.
150+
Unbounded ranges cannot be iterated over, and you cannot call `#toArray()`
151+
for the obvious reason. Calling `#length()` for unbounded ranges will return `Infinity`.
152152

153153
### Negative ranges
154154

@@ -163,8 +163,9 @@ console.log(mr1 + ''); // prints '(-5)-0'
163163
```
164164

165165
Again, note that passing `-5` to the string parser means
166-
"all integers <=5 (including 0 and -10000)" rather than "minus five".
167-
If you are only interested in positive numbers, use
166+
"all integers <=5 (including 0 and all negative integers)"
167+
rather than "minus five".
168+
If you are only interested in positive numbers, you can use
168169
`.intersect('0-')` to drop all negative integers.
169170

170171
### Iteration

0 commit comments

Comments
 (0)