You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-5Lines changed: 9 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -93,20 +93,24 @@ To get the copy of the instance, use `clone()`, or alternatively the copy constr
93
93
-`new MultiRange(data?: Initializer)` Creates a new MultiRange object.
94
94
-`clone(): MultiRange` Clones this instance.
95
95
-`append(value: Initializer): MultiRange` Appends to this instance.
96
-
-`appendRange(min: number, max: number): MultiRange` Appends one range specified by the two parameters.
97
96
-`subtract(value: Initializer): MultiRange` Subtracts from this instance.
98
-
-`subtractRange(min: number, max: number): MultiRange` Subtracts one range specified by the two parameters.
99
97
-`intersect(value: Initializer): MultiRange` Remove integers which are not included in `value` (aka intersection).
100
98
-`has(value: Initializer): boolean` Checks if the instance contains the specified value.
101
-
-`hasRange(min: number, max: number): boolean` Checks if the instance contains the range specified by the two parameters.
102
-
-`isContinuous(): boolean` Checks if the current instance is continuous. Note that this returns false if the current range is empty.
103
-
-`length(): number` Calculates how many numbers are effectively included in this instance. (`multirange('1-10,51-60,90').length()` returns 21)
99
+
-`length(): number` Calculates how many numbers are effectively included in this instance. (ie, 5 for '3,5-7,9')
100
+
-`segmentLength(): number` Returns the number of range segments (ie, 3 for '3,5-7,9' and 0 for an empty range)
104
101
-`equals(cmp: Initializer): boolean` Checks if two MultiRange data are identical.
105
102
-`toString(): string` Returns the string respresentation of this MultiRange.
106
103
-`getRanges(): [number, number][]` Exports the whole range data as an array of [number, number] arrays.
107
104
-`toArray(): number[]` Builds an array of integer which holds all integers in this MultiRange. Note that this may be slow and memory-consuming for large ranges such as '1-10000'.
108
105
-`getIterator(): Object` Returns ES6-compatible iterator. See the description below.
109
106
107
+
The following methods are deprecated and may be removed in future releases:
108
+
109
+
-`appendRange(min: number, max: number): MultiRange` Use `append([[min, max]])` instead.
110
+
-`subtractRange(min: number, max: number): MultiRange` Use `subtract([[min, max]])` instead.
111
+
-`hasRange(min: number, max: number): boolean` Use `has([[min, max]])` instead.
112
+
-`isContinuous(): boolean` Use `segmentLength() === 1` instead.
113
+
110
114
### Iteration
111
115
112
116
**ES6 iterator**: If `Symbol.iterator` is defined in the runtime,
0 commit comments