Skip to content

Repository files navigation

Profanity Kit

A lightweight, multilingual profanity detector for JavaScript and TypeScript.

Quality MIT License Node.js 22.13.0 or newer Pre-release

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.

Why Profanity Kit?

  • 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

Installation

Profanity Kit is in pre-release. The next channel 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

Quick start

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 ******"

Learn more

Compatibility

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.

Contributing

Contributions are welcome. Read the contribution guide before opening an issue or pull request.

License

MIT