UNPKG

node-profanity-filter

Version:

A Node.js profanity filter with support for exact matching, obfuscated word detection, and customizable replacement.

33 lines (32 loc) 687 B
export declare class TrieNode { children: Record<string, TrieNode>; isWord: boolean; } export declare class Trie { root: TrieNode; constructor(words?: string[]); /** * Insert a new word * @param word */ insert(word: string): void; /** * Whether the exact word is matched * @param word * @returns */ contains(word: string): boolean; /** * Whether the text includes any matches * @param text * @returns */ containsIn(text: string): boolean; /** * Match the length * @param text * @param start * @returns */ matchLengthAt(text: string, start: number): number; }