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

34 lines (33 loc) 962 B
import { Language, CheckProfanityResult } from '../types/types'; interface FilterConfig { languages?: Language[]; allLanguages?: boolean; caseSensitive?: boolean; wordBoundaries?: boolean; customWords?: string[]; replaceWith?: string; severityLevels?: boolean; ignoreWords?: string[]; logProfanity?: boolean; allowObfuscatedMatch?: boolean; fuzzyToleranceLevel?: number; } declare class Filter { private words; private caseSensitive; private wordBoundaries; private replaceWith?; private severityLevels; private ignoreWords; private logProfanity; private allowObfuscatedMatch; private fuzzyToleranceLevel; constructor(config?: FilterConfig); private normalizeObfuscated; private getRegex; private isFuzzyToleranceMatch; private evaluateSeverity; isProfane(value: string): boolean; checkProfanity(text: string): CheckProfanityResult; } export { Filter };