UNPKG

glin-profanity

Version:

Glin-Profanity is a lightweight and efficient npm package designed to detect and filter profane language in text inputs across multiple languages. Whether you’re building a chat application, a comment section, or any platform where user-generated content

35 lines (34 loc) 1.14 kB
import { CheckProfanityResult, Language, SeverityLevel } from '../types/types'; export interface ProfanityCheckerConfig { languages?: Language[]; allLanguages?: boolean; caseSensitive?: boolean; wordBoundaries?: boolean; customWords?: string[]; replaceWith?: string; severityLevels?: boolean; allowObfuscatedMatch?: boolean; fuzzyToleranceLevel?: number; minSeverity?: SeverityLevel; autoReplace?: boolean; customActions?: (result: CheckProfanityResult) => void; } export declare const useProfanityChecker: (config?: ProfanityCheckerConfig) => { result: CheckProfanityResult; checkText: (text: string) => { filteredWords: string[]; autoReplaced: string; containsProfanity: boolean; profaneWords: string[]; processedText?: string; severityMap?: Record<string, SeverityLevel>; matchContexts?: { word: string; context: string; }[]; }; checkTextAsync: (text: string) => Promise<CheckProfanityResult>; reset: () => void; isDirty: boolean; isWordProfane: (word: string) => boolean; };