{"id":24975,"library":"bad-words-plus","title":"bad-words-plus","description":"A Node.js profanity filter that extends the original badwords library by allowing the first and/or last letter of filtered words to be displayed. Current stable version is 3.0.4 (2020). No recent updates. Key differentiators: placeholder override, regex customization, add/remove words, empty list instantiation, and firstLetter/lastLetter display options. Requires Node >=12. Compared to alternatives like bad-words (the parent project), bad-words-plus adds these display options but may lag in maintenance.","status":"maintenance","version":"3.0.4","language":"javascript","source_language":"en","source_url":"git://github.com/ryan-berdel/bad-words-plus","tags":["javascript","curse","words","profanity","filter"],"install":[{"cmd":"npm install bad-words-plus","lang":"bash","label":"npm"},{"cmd":"yarn add bad-words-plus","lang":"bash","label":"yarn"},{"cmd":"pnpm add bad-words-plus","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package uses default export. ESM import works in Node 12+ with appropriate settings; require() is CommonJS and still works.","wrong":"const Filter = require('bad-words-plus')","symbol":"Filter","correct":"import Filter from 'bad-words-plus'"},{"note":"CommonJS usage; do not destructure as named export.","wrong":"const { Filter } = require('bad-words-plus')","symbol":"Filter (CommonJS)","correct":"const Filter = require('bad-words-plus')"},{"note":"FilterOptions is a TypeScript type, not a runtime value. Use type import.","wrong":"import { FilterOptions } from 'bad-words-plus'","symbol":"Filter type","correct":"import type { FilterOptions } from 'bad-words-plus'"}],"quickstart":{"code":"// Quick start: filter profanity with first letter visible\nimport Filter from 'bad-words-plus';\n\n// Create filter with options\nconst filter = new Filter({ firstLetter: true, lastLetter: false });\n\n// Clean a string\nconsole.log(filter.clean(\"Don't be an ash0le\")); // \"Don't be an a*****\"\n\n// Add custom words\nfilter.addWords('darn', 'heck');\nconsole.log(filter.clean('What the heck!')); // \"What the ****!\"\n\n// Check if profane\nconsole.log(filter.isProfane('ash0le')); // true\n","lang":"typescript","description":"Shows basic instantiation with firstLetter option, custom words, and isProfane check."},"warnings":[{"fix":"Use new Filter({ emptyList: true, list: ['bad', 'word'] })","message":"When using emptyList: true, the filter has no built-in bad words, so addWords must be used to add them.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Ensure replaceRegex includes all characters you want to replace, e.g., /[A-Za-z0-9가-힣_]/g","message":"The replaceRegex option overrides the default regex that matches characters. If misconfigured, the filter may not detect profanity.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Consider migrating to actively maintained alternatives like 'bad-words' or 'leo-profanity'.","message":"Package last updated in 2020; no recent maintenance. May have unpatched vulnerabilities or compatibility issues with newer Node versions.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Use new Filter({ list: ['word1', 'word2'] })","message":"The 'list' option in constructor expects an array of strings; passing a single string will not work.","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":"Run 'npm install bad-words-plus'","cause":"Package not installed or not in node_modules","error":"Error: Could not find module: bad-words-plus"},{"fix":"Use 'import Filter from 'bad-words-plus'' or 'const Filter = require('bad-words-plus')'","cause":"Using wrong import (e.g., destructuring { Filter })","error":"TypeError: filter.clean is not a function"},{"fix":"Ensure filter is created: const filter = new Filter({...})","cause":"Calling clean() or isProfane() without initializing filter","error":"Uncaught TypeError: Cannot read property 'toLowerCase' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}