Skip to content

alessandro-ooo/banned-words-spotter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧰 Simple banned-words-detector 1.2.2

npm i banned-words-spotter

Features

  • 70+ dirty words! List based on encycloDB's dirty words
  • Easy
  • 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("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!

About

Banned words detector in typescript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published