diff options
author | XhmikosR <xhmikosr@gmail.com> | 2021-10-06 00:23:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-06 00:23:14 +0300 |
commit | 2596c9703462f327e20e0464cff26c5ed1f091da (patch) | |
tree | 837b4fd6343f612903895bd8d05f42ffdbe37798 | |
parent | 598b4c59a6f841fc22908c40c7b078e3a065124d (diff) |
util/sanitizer.js: use `Array.every()` (#35120)
-rw-r--r-- | js/src/util/sanitizer.js | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/js/src/util/sanitizer.js b/js/src/util/sanitizer.js index e27961e9a3..f5a8287cd0 100644 --- a/js/src/util/sanitizer.js +++ b/js/src/util/sanitizer.js @@ -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 = { |