A lightweight, multilingual profanity detector for JavaScript and TypeScript.
Documentation · Playground · GitHub
Profanity Kit provides predictable, synchronous word filtering without a moderation service or an opaque machine-learning model. It is a deterministic profanity detection toolkit, not a contextual moderation or toxicity classifier.
- Unicode-aware, whole-word matching
- Explicit, bundle-friendly language packs
- Detailed match metadata with source offsets
- Immutable detector configuration
- Synchronous and runtime agnostic
- Zero runtime dependencies
Profanity Kit is in pre-release. The
nextchannel will become available during the release rehearsal.
| Package manager | Command |
|---|---|
| npm | npm install profanity-kit@next |
| pnpm | pnpm add profanity-kit@next |
| Yarn | yarn add profanity-kit@next |
| Bun | bun add profanity-kit@next |
The root entry point includes the English language pack:
import { createDetector } from "profanity-kit";
const detector = createDetector();
detector.check("This contains shit"); // true
detector.filter("Hide the shit"); // "Hide the ****"Use the dictionary-free core when selecting another language explicitly:
import { createDetector } from "profanity-kit/core";
import { indonesian } from "profanity-kit/languages/id";
const detector = createDetector({ languages: [indonesian] });
detector.check("Dasar goblok"); // true
detector.filter("Dasar goblok"); // "Dasar ******"Profanity Kit supports Node.js 22.13.0 or newer and modern browsers under the Baseline Widely Available policy. It ships as ESM with TypeScript declarations.
Contributions are welcome. Read the contribution guide before opening an issue or pull request.