{"id":24972,"library":"bad-words-br","title":"bad-words-br","description":"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.","status":"active","version":"3.0.11","language":"javascript","source_language":"en","source_url":"git://github.com/kylix31/badwords-br","tags":["javascript","curse","words","profanity","filter"],"install":[{"cmd":"npm install bad-words-br","lang":"bash","label":"npm"},{"cmd":"yarn add bad-words-br","lang":"bash","label":"yarn"},{"cmd":"pnpm add bad-words-br","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM default export. CJS require also works as shown in README.","wrong":"const Filter = require('bad-words-br')","symbol":"Filter","correct":"import Filter from 'bad-words-br'"},{"note":"CommonJS usage. Do not destructure import; it's a default export.","wrong":"const { Filter } = require('bad-words-br')","symbol":"Filter","correct":"const Filter = require('bad-words-br')"},{"note":"Named import is wrong; it's a default export.","wrong":"import { Filter } from 'bad-words-br'","symbol":"Filter","correct":"import Filter from 'bad-words-br'"}],"quickstart":{"code":"import Filter from 'bad-words-br';\n\nconst filter = new Filter();\nconst cleaned = filter.clean('Don\\'t be an ash0le');\nconsole.log(cleaned); // \"Don't be an ******\"\n\nconst customFilter = new Filter({ placeHolder: 'x' });\nconsole.log(customFilter.clean('Don\\'t be an ash0le')); // \"Don't be an xxxxxx\"\n\nconsole.log(filter.isProfane('ash0le')); // true\n\nfilter.addWords('foo', 'bar');\nconsole.log(filter.clean('foo bar')); // \"*** ***\"\n\nfilter.removeWords('ash0le');\nconsole.log(filter.clean('Don\\'t be an ash0le')); // \"Don't be an ash0le\"","lang":"typescript","description":"Shows basic usage: import Filter, instantiate, clean a string, use custom placeholder, check profanity, add/remove words."},"warnings":[{"fix":"Update Node.js to >=8.0.0 or use a transpiler like Babel.","message":"Version 2.0.0 dropped support for Node <8 and requires ES2016+ environment.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use 'replaceRegex' option instead of 'regex'.","message":"Constructor option 'regex' is deprecated in favor of 'replaceRegex' as of v3.0.0.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"If you need a different placeholder, set 'placeHolder' option explicitly.","message":"The default placeholder character is '*', not '#' or any other symbol.","severity":"gotcha","affected_versions":"*"},{"fix":"Use filter.addWords(...array) instead of filter.addWords(array).","message":"Calling 'addWords' with multiple arguments adds each word individually, but passing an array requires spread operator.","severity":"gotcha","affected_versions":"*"},{"fix":"Install @types/bad-words-br or declare module manually.","message":"The package does not provide TypeScript type definitions; you may need to create your own or use @types/bad-words-br if available.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'import Filter from 'bad-words-br'' or 'const Filter = require('bad-words-br').","cause":"Using default import incorrectly (e.g., import { Filter } from 'bad-words-br').","error":"TypeError: Filter is not a constructor"},{"fix":"Run 'npm install bad-words-br --save'.","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'bad-words-br'"},{"fix":"Use CommonJS require or upgrade Node.js to version that supports ES modules.","cause":"Running code in an environment that does not support ES modules (e.g., older Node.js).","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}