Skip to content

Commit

Permalink
fix: replace regex used to split ranges (#434)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lukekarrys committed Mar 25, 2022
1 parent cb1ca1d commit 9ab7b71
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion classes/range.js
Expand Up @@ -29,7 +29,7 @@ class Range {
// First, split based on boolean or ||
this.raw = range
this.set = range
.split(/\s*\|\|\s*/)
.split('||')
// map the range to a 2d array of comparators
.map(range => this.parseRange(range.trim()))
// throw out any comparator lists that are empty
Expand Down

0 comments on commit 9ab7b71

Please sign in to comment.