npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

censorship-id

v2.0.3

Published

A robust Indonesian profanity filter with severity levels, category detection, and leetspeak handling.

Readme

censorship-id

npm version License: MIT

A robust, feature-rich, and lightweight Indonesian profanity filter. Fully redesigned for v2.0.0, it supports structured metadata detection, severity levels, categories, whitelisting, leetspeak evasion handling, and custom dictionary management.

Features

  • Multi-purpose API: Censor text, detect profane words with metadata (severity/category), or perform simple boolean checks.
  • Smart Mode: Handles advanced evasion techniques (leetspeak, repeated characters, punctuation-in-word).
  • Categorization & Severity: Dictionary entries are classified into categories (vulgar, slur, sexual, offensive, slang) and severity levels (low, medium, high).
  • Whitelisting: Easily allow specific words to bypass filtering.
  • Dictionary Management: Dynamically add or remove words globally at runtime.
  • Lightweight: Zero production dependencies. Built for CJS and ESM with full TypeScript support.

Installation

npm install censorship-id

Reorganized Structure

censorship-id/
├── src/
│   ├── index.js          # Core filter implementation (detect, censorId, isProfane)
│   ├── dictionary.js     # Structured Indonesian profanity database
│   └── index.d.ts        # TypeScript declarations
├── test/
│   └── index.test.js     # Jest unit tests
├── dist/                 # Build outputs (CJS, ESM, Types)
└── package.json

API Reference

1. censorId(text, options)

Replaces profane words with a mask character.

const { censorId } = require("censorship-id");

// Basic
censorId("anjing kau!");
// => "****** kau!"

// Keep first and last letter
censorId("anjing kau!", { keepFirstAndLast: true });
// => "a****g kau!"

// Custom mask character
censorId("anjing kau!", { mask: "#" });
// => "###### kau!"

Options:

  • mask (string, default: *): Mask character.
  • keepFirstAndLast (boolean, default: false): Keep first and last letters visible.
  • allowedWords (string[]): Words to bypass filtering.
  • customWords (string[] | object[]): Additional words to censor.
  • smartMode (boolean, default: false): Handle obfuscation (e.g., 4njing, baaaaabiii).
  • minSeverity ('low' | 'medium' | 'high'): Minimum severity level to censor.
  • categories (string[]): Only censor specific categories (e.g., ['slur', 'sexual']).

2. detect(text, options)

Scans text and returns structured metadata about all matches.

const { detect } = require("censorship-id");

const results = detect("dasar anjing kau!");
console.log(results);
/*
Output:
[
  {
    match: "anjing",
    word: "anjing",
    index: 6,
    length: 6,
    severity: "high",
    category: "offensive"
  }
]
*/

// Using smartMode
detect("dasar 4njing!", { smartMode: true });
/*
Output:
[
  {
    match: "4njing",
    word: "anjing",
    index: 6,
    length: 6,
    severity: "high",
    category: "offensive"
  }
]
*/

Options: Same as censorId (minus mask and keepFirstAndLast) plus:

  • unique (boolean, default: false): If true, only returns the first occurrence of each unique word.

3. isProfane(text, options)

Returns a boolean indicating if the text contains any profanity.

const { isProfane } = require("censorship-id");

isProfane("Halo apa kabar?"); // => false
isProfane("Dasar anjing!"); // => true
isProfane("Dasar anjing!", { minSeverity: "high" }); // => true

4. Dictionary Management

Modify the default database at runtime.

const { addWords, removeWords, getDictionary } = require("censorship-id");

// Add string words (assigns medium severity & custom category)
addWords(["perkosa", "bodoh"]);

// Add words with metadata
addWords([{ word: "jelek", severity: "low", category: "offensive" }]);

// Remove words
removeWords(["jelek", "bodoh"]);

// Retrieve copy of active dictionary
const activeDictionary = getDictionary();

Severity & Categories

The package classifies Indonesian words into the following categories and levels:

| Category | Level | Description | Examples | | ----------- | ------ | ---------------------------------------- | --------------------------------------- | | sexual | High | Highly vulgar/anatomical terms | kontol, memek, ngentot, pepek | | slur | High | Offensive slurs targeting identity | banci, bencong, lonte, perek | | offensive | High | Harsh expressions, insults | bangsat, bajingan, anjing, babi | | vulgar | Medium | Inappropriate bodily or vulgar slang | berak, tai, sempak | | offensive | Medium | Insulting terms for intellect | bego, goblok, tolol, dungu | | slang | Medium | Inappropriate regional slang/swear words | anjir, cuk, dancuk, jancuk | | offensive | Low | Mild insults or slang | buaya, najis, ndeso, kere | | vulgar | Low | Mild sexual references, innuendo | bokep, sange, lendir |


License

MIT © rheatkhs