Skip to content

Commit 9ab7b71

Browse files
authored
fix: replace regex used to split ranges (#434)
Found in #433, the regex used to split ranges on `||` was padded by `\s*` on either side causing a decrease in performance when used on range strings with a lot of spaces. Since the result of the split is immediately trimmed, we can just split on the string instead.
1 parent cb1ca1d commit 9ab7b71

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

classes/range.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Range {
2929
// First, split based on boolean or ||
3030
this.raw = range
3131
this.set = range
32-
.split(/\s*\|\|\s*/)
32+
.split('||')
3333
// map the range to a 2d array of comparators
3434
.map(range => this.parseRange(range.trim()))
3535
// throw out any comparator lists that are empty

0 commit comments

Comments
 (0)