0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-26 23:54:23 +01:00

util/sanitizer.js: use Array.every() (#35120)

This commit is contained in:
XhmikosR 2021-10-06 00:23:14 +03:00 committed by GitHub
parent 598b4c59a6
commit 2596c97034
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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 = {