From 9ab7b717dd7848c639b8ce3366d2241d430cdad2 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 25 Mar 2022 11:29:53 -0700 Subject: [PATCH] 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. --- classes/range.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/range.js b/classes/range.js index aa04f6bf..9e04555c 100644 --- a/classes/range.js +++ b/classes/range.js @@ -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