Remove whitespace characters in banned words detection
This commit is contained in:
parent
c1b955aaae
commit
aba1d02941
@ -1,5 +1,6 @@
|
|||||||
import fs from "fs/promises";
|
import fs from "fs/promises";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import { InvisibleCharacters } from "./InvisibleCharacters";
|
||||||
|
|
||||||
var words: string[];
|
var words: string[];
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ export const BannedWords = {
|
|||||||
get: () => words,
|
get: () => words,
|
||||||
|
|
||||||
find: (val: string) => {
|
find: (val: string) => {
|
||||||
|
InvisibleCharacters.forEach(x => val = val.replaceAll(x, ""));
|
||||||
return words.some((x) => val.indexOf(x) != -1);
|
return words.some((x) => val.indexOf(x) != -1);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user