Registry / serialization / bad-words-br

bad-words-br

JSON →
library3.0.11jsnpmunverified

A JavaScript profanity filter for Brazilian Portuguese, forked from the popular bad-words library. Version 3.0.11 is the latest stable release. It provides a simple API to clean strings by replacing blacklisted words with a placeholder (default '*'). Key differentiators include support for custom placeholders, regex overrides, adding/removing words from the blacklist, and instantiation with an empty list. The package is designed for Node.js (>=8.0.0) and requires an ES2016+ environment or transpiler. It is released under MIT license and follows semantic versioning.

npm install bad-words-br
INSTALL
IMPORT
SIG · BAD-WORDS-BR
B
bad-words-br
serializationjavascriptv3.0.11
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 'bad-words-br'
const Filter = require('bad-words-br')
ESM default export. CJS require also works as shown in README.
Filter
const Filter = require('bad-words-br')
const { Filter } = require('bad-words-br')
CommonJS usage. Do not destructure import; it's a default export.
Filter
import Filter from 'bad-words-br'
import { Filter } from 'bad-words-br'
Named import is wrong; it's a default export.

Shows basic usage: import Filter, instantiate, clean a string, use custom placeholder, check profanity, add/remove words.

import Filter from 'bad-words-br'; const filter = new Filter(); const cleaned = filter.clean('Don\'t be an ash0le'); console.log(cleaned); // "Don't be an ******" const customFilter = new Filter({ placeHolder: 'x' }); console.log(customFilter.clean('Don\'t be an ash0le')); // "Don't be an xxxxxx" console.log(filter.isProfane('ash0le')); // true filter.addWords('foo', 'bar'); console.log(filter.clean('foo bar')); // "*** ***" filter.removeWords('ash0le'); console.log(filter.clean('Don\'t be an ash0le')); // "Don't be an ash0le"
Debug
Known issues
breakingVersion 2.0.0 dropped support for Node <8 and requires ES2016+ environment.
fix
Update Node.js to >=8.0.0 or use a transpiler like Babel.
affects: >=2.0.0
deprecatedConstructor option 'regex' is deprecated in favor of 'replaceRegex' as of v3.0.0.
fix
Use 'replaceRegex' option instead of 'regex'.
affects: >=3.0.0
gotchaThe default placeholder character is '*', not '#' or any other symbol.
fix
If you need a different placeholder, set 'placeHolder' option explicitly.
affects: *
gotchaCalling 'addWords' with multiple arguments adds each word individually, but passing an array requires spread operator.
fix
Use filter.addWords(...array) instead of filter.addWords(array).
affects: *
gotchaThe package does not provide TypeScript type definitions; you may need to create your own or use @types/bad-words-br if available.
fix
Install @types/bad-words-br or declare module manually.
affects: >=3.0.0
Errors
Common errors & fixes
TypeError: Filter is not a constructor
Using default import incorrectly (e.g., import { Filter } from 'bad-words-br').
fix
Use 'import Filter from 'bad-words-br'' or 'const Filter = require('bad-words-br').
Error: Cannot find module 'bad-words-br'
Package not installed or not in node_modules.
fix
Run 'npm install bad-words-br --save'.
SyntaxError: Unexpected token 'export'
Running code in an environment that does not support ES modules (e.g., older Node.js).
fix
Use CommonJS require or upgrade Node.js to version that supports ES modules.
Upgrade
Version history
3.0.11latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
bad-words-br — npm install bad-words-br · libregistry