]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
util/sanitizer.js: use `Array.every()` (#35120)
authorXhmikosR <xhmikosr@gmail.com>
Tue, 5 Oct 2021 21:23:14 +0000 (00:23 +0300)
committerGitHub <noreply@github.com>
Tue, 5 Oct 2021 21:23:14 +0000 (00:23 +0300)
js/src/util/sanitizer.js

index e27961e9a3efc450d986a8368a7bad4398f41983..f5a8287cd02bb0c43126ad9f85754e4c758e041f 100644 (file)
@@ -43,16 +43,9 @@ const allowedAttribute = (attribute, allowedAttributeList) => {
     return true
   }
 
-  const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)
-
   // Check if a regular expression validates the attribute.
-  for (const element of regExp) {
-    if (element.test(attributeName)) {
-      return true
-    }
-  }
-
-  return false
+  return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)
+    .every(regex => regex.test(attributeName))
 }
 
 export const DefaultAllowlist = {