Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
bad-words-next
Advanced tools
Profanity filtering and detection.
Quick overnight project. Feel free to contribute.
API documentation in GitHub Wiki.
yarn add bad-words-next
or
npm install bad-words-next
const BadWordsNext = require('bad-words-next')
const en = require('bad-words-next/data/en.json')
const badwords = new BadWordsNext({ data: en })
// Returns true when passed string contains a bad word
console.log(badwords.check('S0me sh!tt is here'))
// will print `true`
// Returns filtered string with masked bad words
console.log(badwords.filter('S0me sh!tt is here'))
// will print `S0me *** is here`
const BadWordsNext = require('bad-words-next')
const en = require('bad-words-next/data/en.json')
const es = require('bad-words-next/data/es.json')
const fr = require('bad-words-next/data/fr.json')
const de = require('bad-words-next/data/de.json')
const ru = require('bad-words-next/data/ru.json')
const rl = require('bad-words-next/data/ru_lat.json')
const ua = require('bad-words-next/data/ua.json')
const pl = require('bad-words-next/data/pl.json')
const ch = require('bad-words-next/data/ch.json')
const badwords = new BadWordsNext()
badwords.add(en)
badwords.add(es)
badwords.add(fr)
badwords.add(de)
badwords.add(ru)
badwords.add(rl)
badwords.add(ua)
badwords.add(pl)
badwords.add(ch)
interface Data {
id: string // unique ID
words: string[] // words list, supports `*` on start and end of a string to indicate any characters, also `+` for one or more repeating characters, and `_` for special characters.
lookalike: Lookalike // map for homoglyphs conversion
}
interface Lookalike {
[key: string | number]: string // just a simple key-value object
}
interface Options {
data?: Data // Dictionary data
placeholder?: string // Filter placeholder - default value '***'
specialChars?: RegExp // Special chars to allow on word start and word end - default value /\d|[!@#$%^&*()[\];:'",.?\-_=+~`|]|a|(?:the)|(?:el)|(?:la)/
spaceChars?: string[] // Pseudo space chars, a list of values for `_` symbol in a dictionary word string - default value ['', '.', '-', '_', ';', '|']
confusables?: string[] // List of ids to apply transformations from `confusables` npm package - default ['en', 'es', 'de']
}
Filtering may be potentially slow on large strings and large dictionaries
Dictionary words with spaces won't work
Dictionaries have to be improved over time
FAQs
JavaScript/TypeScript filter and checker for bad words aka profanity
The npm package bad-words-next receives a total of 0 weekly downloads. As such, bad-words-next popularity was classified as not popular.
We found that bad-words-next demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.