- 70+ dirty words! List based on encycloDB's dirty words
- Easy
- Typescript 4.9.5
- Detects variants (example: "baaaaadword", "badwoooooooord")
checks if a word or a long text contains banned words.
hasBannedWords("Badword");
// Output: true
hasBannedWords("This is a badword!");
// Output: true
hasBannedWords("Hello world!");
// Output: false
console.log(redactBannedWords("Leave this badword outta my badwording face!"));
// Output: Leave this ***** outta my ***** face!
console.log(redactBannedWords("Leave this badword outta my badwording face!", "[REDACTED]"));
// Output: Leave this [REDACTED] outta my [REDACTED] face!