fixing blacklist

This commit is contained in:
weakmap@gmail.com
2025-06-14 19:25:52 +02:00
parent 9065448b6b
commit 2b862b2d98

View File

@@ -9,12 +9,9 @@ function inDevMode(){
}
function isOneOf(word, arr) {
if (arr == null || arr.length === 0) {
return false;
}
const expression = String.raw`\b(${arr.join('|')})\b`;
const blacklist = new RegExp(expression, 'ig');
return blacklist.test(word);
if (!arr || arr.length === 0 || word == null) return false;
const lowerWord = word.toLowerCase();
return arr.some(item => lowerWord.indexOf(item.toLowerCase()) !== -1);
}
function nullOrEmpty(val) {