Install
npm i profanity-kityarn add profanity-kitpnpm add profanity-kitbun add profanity-kitCreate a detector
import { createDetector } from "profanity-kit";
const detector = createDetector();
detector.check("This contains shit"); // true
detector.isClean("This is fine"); // true
detector.filter("hide the shit"); // "hide the ****"findAll() returns ordered match details when you need offsets or language
codes.
Combine languages
Profanity Kit includes built-in English and Indonesian packs. Import the dictionary-free core to use either pack independently or combine them in one detector:
import { createDetector } from "profanity-kit/core";
import { english } from "profanity-kit/languages/en";
import { indonesian } from "profanity-kit/languages/id";
const detector = createDetector({ languages: [english, indonesian] });
detector.check("This contains shit"); // true
detector.check("Dasar goblok"); // trueSee Languages & Dictionaries to select one pack, combine packs, or create a custom pack. You can also learn how matching works.
Compatibility
Profanity Kit supports Node.js >=22.13.0 and modern browsers under the
Baseline Widely Available policy. It publishes a single ESM implementation;
modern Node.js can load the same files with require() when the module graph
has no top-level await.