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

@fldx/sopan

v1.0.1

Published

Small TypeScript-first profanity filter for Indonesian text.

Readme

@fldx/sopan

banner

Small TypeScript-first profanity filter for Indonesian text.

@fldx/sopan is dependency-free at runtime and exposes a compact API for JavaScript and TypeScript projects.

Install

npm install @fldx/sopan
pnpm add @fldx/sopan
yarn add @fldx/sopan
bun add @fldx/sopan

Usage

import { addWords, clean, containsProfanity, findProfanity } from "@fldx/sopan";

addWords(["kasar"]);

containsProfanity("dasar t41"); // true
findProfanity("A*N*J*I*N*G");
clean("dasar t41"); // "dasar ***"
clean("ka$aar!"); // "***!"

CommonJS is supported too:

const { clean, containsProfanity } = require("@fldx/sopan");

containsProfanity("ta1"); // true
clean("ta1"); // "***"

API

addWords(words)

Adds words to the shared default filter once, so future calls to containsProfanity, findProfanity, and clean detect them automatically.

addWords(["kasar", "kata-baru"]);

containsProfanity("ka$aar"); // true
clean("kata-baru"); // "***"

clearWords()

Removes words previously registered through addWords.

clearWords();

containsProfanity(input, options)

Returns true when the input contains a profane word.

containsProfanity("ini santai"); // false
containsProfanity("ini tai"); // true
containsProfanity("ka$aar", { additionalWords: ["kasar"] }); // true

findProfanity(input, options)

Returns match details with the configured dictionary word, raw token, normalized token, and index.

findProfanity("halo t41");
// [{ word: "tai", raw: "t41", normalized: "tai", index: 5 }]

findProfanity("ka$aar", { additionalWords: ["kasar"] });
// [{ word: "kasar", raw: "ka$aar", normalized: "kasar", index: 0 }]

clean(input, options)

Replaces profane words with "***" by default.

clean("dasar t41"); // "dasar ***"
clean("dasar t41", { replacement: "[redacted]" });
clean("dasar t41", { replacement: (match) => `[${match.word}]` });
clean("ka$aar", { additionalWords: ["kasar"], replacement: "[custom]" });

createFilter(options)

Creates a custom filter with your own word list.

const filter = createFilter({
  words: ["kasar", "contoh"] as const
});

filter.containsProfanity("ka$aar");

Matching Behavior

The default filter focuses on Indonesian profanity and normalizes:

  • mixed casing: TAI
  • simple leetspeak: t41, ta1
  • symbol separators: a*n*j*i*n*g
  • repeated letters: annjiiinggg

Matching is token-based, so tai is detected while santai is not.

The default Indonesian word list was expanded from public Indonesian rude-word references including Wiktionary's Indonesian "kata kasar" category, a translator-maintained Indonesian profanity list, a public GitHub gist, and selected regional Indonesian references for Sundanese, Javanese, Batak, and Medan usage. It intentionally keeps only single-token words in the core package.

Roadmap

  • Expand Indonesian dictionary coverage.
  • Add language packs without increasing the default bundle size.
  • Add optional phrase matching for multi-word profanity.