]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Use regex.test() when we want to check for a Boolean. (#29969)
authorXhmikosR <xhmikosr@gmail.com>
Tue, 7 Jan 2020 20:07:51 +0000 (22:07 +0200)
committerXhmikosR <xhmikosr@gmail.com>
Mon, 17 Feb 2020 19:33:54 +0000 (21:33 +0200)
build/vnu-jar.js
js/src/tools/sanitizer.js

index eb1fbc4b29a184781b1aa265bf610fd291e917bf..ebd027adcf2637b7a7a82620b27f3a2fbb3a2dc7 100644 (file)
@@ -18,7 +18,7 @@ childProcess.exec('java -version', (error, stdout, stderr) => {
     return
   }
 
-  const is32bitJava = !stderr.match(/64-Bit/)
+  const is32bitJava = !/64-Bit/.test(stderr)
 
   // vnu-jar accepts multiple ignores joined with a `|`.
   // Also note that the ignores are regular expressions.
index 0e83bde477eb80d6997e995b5534fa19259cc022..f108c66d5acb5778a620e088a9305f5219c9cbba 100644 (file)
@@ -71,7 +71,7 @@ function allowedAttribute(attr, allowedAttributeList) {
 
   if (allowedAttributeList.indexOf(attrName) !== -1) {
     if (uriAttrs.indexOf(attrName) !== -1) {
-      return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
+      return SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)
     }
 
     return true
@@ -80,8 +80,8 @@ function allowedAttribute(attr, allowedAttributeList) {
   const regExp = allowedAttributeList.filter((attrRegex) => attrRegex instanceof RegExp)
 
   // Check if a regular expression validates the attribute.
-  for (let i = 0, l = regExp.length; i < l; i++) {
-    if (attrName.match(regExp[i])) {
+  for (let i = 0, len = regExp.length; i < len; i++) {
+    if (regExp[i].test(attrName)) {
       return true
     }
   }