Skip to content

Commit b685d55

Browse files
ezkemboitux-tn
andauthored
chore: refactor code in isDataURI validator (#1556)
* refactor code in isdatauri validator * Delete validator.js * Delete validator.min.js Co-authored-by: Sarhan Aissi <tux-tn@users.noreply.github.com>
1 parent 941abe1 commit b685d55

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/lib/isDataURI.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ export default function isDataURI(str) {
2222
return false;
2323
}
2424
for (let i = 0; i < attributes.length; i++) {
25-
if (i === attributes.length - 1 && attributes[i].toLowerCase() === 'base64') {
26-
// ok
27-
} else if (!validAttribute.test(attributes[i])) {
25+
if (
26+
!(i === attributes.length - 1 && attributes[i].toLowerCase() === 'base64') &&
27+
!validAttribute.test(attributes[i])
28+
) {
2829
return false;
2930
}
3031
}

0 commit comments

Comments
 (0)