UNPKG

turkish-profanity-filter

Version:

A configurable Turkish profanity filter for text content

84 lines (71 loc) 2.11 kB
declare module 'turkish-profanity-filter' { interface TurkishProfanityFilterOptions { /** * List of profanity words to detect */ wordList?: string[]; /** * Whether to match only whole words * @default true */ wholeWords?: boolean; /** * Whether to match case-sensitively * @default false */ caseSensitive?: boolean; /** * String to replace profanity with * @default '***' */ replacement?: string; } class TurkishProfanityFilter { /** * Creates a new filter instance with optional configuration */ constructor(options?: TurkishProfanityFilterOptions); /** * Filter configuration options */ options: TurkishProfanityFilterOptions; /** * Regular expression used for matching */ regexp: RegExp; /** * Check if text contains profanity * @param text - The text to check * @returns True if profanity found, false otherwise */ check(text: string): boolean; /** * Get all profanity words found in text * @param text - The text to analyze * @returns Array of found profanity words */ getWords(text: string): string[]; /** * Censor profanity in text * @param text - The text to censor * @returns Text with profanity replaced by the replacement string */ censor(text: string): string; /** * Add words to the filter * @param words - Word(s) to add */ addWords(words: string | string[]): void; /** * Remove words from the filter * @param words - Word(s) to remove */ removeWords(words: string | string[]): void; /** * Build the regular expression used for matching * @private */ private _buildRegExp(): void; } export = TurkishProfanityFilter; }