banned-words-spotter
v1.2.3
Published
Banned words detector
Downloads
2
Maintainers
Readme
🧰 Simple banned-words-detector 1.2.3
Features
- 70+ dirty words! List based on encycloDB's dirty words
- Easy to use
- Typescript 4.9.5
- Detects variants (example: "baaaaadword", "badwoooooooord")
Functions
hasBannedWords(text: string): boolean
checks if a word or a long text contains banned words.
hasBannedWords("Badword");
// Output: true
hasBannedWords("Baaaaadword");
// Output: true
hasBannedWords("This is a badword!");
// Output: true
hasBannedWords("Hello world!");
// Output: false
redactBannedWords(text: string, censor: string = "******"): string
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!