@shiva.710_/bad-words-lib
v1.0.3
Published
A TypeScript library that provides utilities to detect bad words using a Trie data structure.
Readme
🚫 Bad Words Library
A TypeScript library that provides utilities to detect bad words using a Trie data structure.
📦 Installation
npm install "@shiva.710_/bad-words-lib"🚀 Usage
1. Import the Library
import { isBadWord, startsWith } from "bad-words-lib";2. Check for Bad Words
console.log(isBadWord("2g1c")); // true
console.log(isBadWord("safeWord")); // false3. Check for Bad Word Prefixes
console.log(startsWith("2g")); // true
console.log(startsWith("abc")); // false🧪 Running Tests
npm test📜 API Reference
isBadWord(word: string): boolean
Checks if a given word exists in the bad words trie.startsWith(prefix: string): boolean
Checks if a given prefix is valid in the trie.
📓 License
MIT
