aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGokulakrishna <gokulakrishna@rocketmail.com>2018-05-28 15:13:33 +0530
committerGitHub <noreply@github.com>2018-05-28 15:13:33 +0530
commit1e351b9a7c5d7aa4c1dd65ba3f3ef3b45ac5689a (patch)
tree416bf1e9f0420879b4be7d4c031a8d6a26304839
parentd9d3600be3cf3aff551e5a8e4acb38239a0507be (diff)
For ExcludeMatch, switched regex.exec to regex.test
As per Mozilla documentation, regex test() is faster than exec(). For ExcludeMatch, we just need to see true or false, that can be done faster with test() for large exclude patterns.
-rw-r--r--js/redirect.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/js/redirect.js b/js/redirect.js
index 75f000d..ac06ff7 100644
--- a/js/redirect.js
+++ b/js/redirect.js
@@ -266,7 +266,7 @@ Redirect.prototype = {
if (!this._rxExclude) {
return false;
}
- var shouldExclude = !!this._rxExclude.exec(url);
+ var shouldExclude = this._rxExclude.test(url);
this._rxExclude.lastIndex = 0;
return shouldExclude;
}