Registry / crm-productivity / badwords-ko

badwords-ko

JSON →
library1.0.4jsnpmunverified

A Korean profanity filter library for Node.js and browser, v1.0.4 (current stable). Provides a Filter class with customizable placeholder, regex, and blacklist management (add/remove words). Supports ES6+ import syntax. Built as a Korean adaptation of the bad-words npm package. Lightweight, no dependencies, TypeScript definitions not shipped. Slow release cadence (last update 2022). Differentiator: specifically targets Korean profanity with a built-in blacklist of Korean curse words, unlike generic profanity filters.

npm install badwords-ko
INSTALL
IMPORT
SIG · BADWORDS-KO
B
badwords-ko
crm-productivityjavascriptv1.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Filter
import Filter from 'badwords-ko'
const Filter = require('badwords-ko')
Package uses ES module default export. CommonJS require without .default will fail. Use with transpiler/Babel.
Filter (named import)
import { Filter } from 'badwords-ko'
const { Filter } = require('badwords-ko');
Named export is not available; only default export exists. CommonJS destructuring will result in undefined.
require (CommonJS)
const Filter = require('badwords-ko').default
const Filter = require('badwords-ko');
Since version 1.0.0, the package is ESM-only. In CommonJS environments, you must use .default to access the constructor.

Creates a Filter instance, checks for profanity, cleans text with default/regex/placeholder, adds and removes custom blacklist words.

import Filter from 'badwords-ko'; const filter = new Filter(); console.log(filter.isProfane('시발')); // true console.log(filter.clean('욕을 합니다 개새끼')); // '욕을 합니다 ***' const customFilter = new Filter({ placeHolder: 'x', list: ['나쁜'] }); customFilter.addWords('무진장'); console.log(customFilter.clean('무진장 나쁜 말!')); // 'xxxx xxx 말!' filter.removeWords('시발'); console.log(filter.clean('시발')); // '시발' (no longer filtered)
Debug
Known issues
deprecatedPackage uses deprecated 'bad-words' as reference; original package no longer maintained.
fix
Consider using 'bad-words-next' or build your own filter for better maintainability.
affects: >=1.0.0
gotchaConstructor accepts 'regex' option but actually uses 'replaceRegex' for replacement; 'regex' is for sanitization before matching.
fix
Use 'replaceRegex' option to control replacement regex, not 'regex'.
affects: >=1.0.0
gotchaCalling addWords/removeWords with a single array will treat array as one word; use spread operator.
fix
Use filter.addWords(...list) instead of filter.addWords(list).
affects: >=1.0.0
breakingPackage is ESM-only and does not export a CommonJS module; requires transpiler or Node.js >=16 with type: module.
fix
Use ES modules or set project to type: module. Alternatively, use dynamic import() in CommonJS.
affects: >=1.0.0
Errors
Common errors & fixes
const Filter = require('badwords-ko'); TypeError: Filter is not a constructor
Requiring the module directly returns the module exports, not the default export.
fix
Use const Filter = require('badwords-ko').default;
import Filter from 'badwords-ko'; SyntaxError: Cannot use import statement outside a module
Using ES import syntax in a CommonJS environment without proper module configuration.
fix
Add 'type': 'module' to package.json or use .mjs extension.
filter.clean('some string') returns same string even when profane words present
Possibly empty blacklist if (emptyList: true) or words not added.
fix
Ensure you don't set emptyList: true unless you intend to add words later. Use new Filter() without options.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
51 hits · last 30 days
node
44
OpenAI (training)
1
Resources
badwords-ko — npm install badwords-ko · libregistry