Core Functions
Essential JavaScript/TypeScript functions for profanity detection
The core functions provide the primary interface for profanity detection in JavaScript and TypeScript applications.
checkProfanity
The primary function for comprehensive profanity detection.
function checkProfanity(
text: string,
config?: ProfanityCheckerConfig
): ProfanityCheckResultBasic Example
import { checkProfanity } from 'glin-profanity';
const result = checkProfanity("This is damn good!");
console.log(result.containsProfanity); // true
console.log(result.profaneWords); // ["damn"]isWordProfane
Quick boolean check for individual words.
function isWordProfane(
word: string,
config?: ProfanityCheckerConfig
): booleanBasic Example
import { isWordProfane } from 'glin-profanity';
console.log(isWordProfane('hello')); // false
console.log(isWordProfane('damn')); // trueCross-References
- React Hook - React integration
- Filter Class - Object-oriented API