
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
swearjar-extended
Advanced tools
Profanity detection and filtering library.
npm install --save swearjar-extended
Returns true if the given string contains profanity.
var swearjar = require('swearjar-extended');
swearjar.profane("hello there"); // false
swearjar.profane("fuck you john doe"); // true
Replaces profanity with asterisks.
var clean = swearjar.censor("fuck you john doe bitch"); // **** you john doe *****
Get the words alongside there categories.
swearjar.words('fuck you john doe'); // { fuck: ['sexual'] }
Get the words alongside there categories, count and censor the text.
swearjar.detailedProfane('fuck you john doe')
returns:
{
categoryCount: {
sexual: 1
},
censored: '**** you john doe',
profane: true,
wordCount: {
fuck: 1
},
words: {
fuck: [
'sexual'
]
}
}
Generates a report from the given text.
swearjar.scorecard("fuck you john doe bitch fuck"); // {sexual: 2, insult: 1}
Add a regex.
swearjar.addRegex('addedword?\\b', ['detected']);
Add a simple word.
swearjar.addSimple('addedword', ['detected']);
Add an emoji word.
swearjar.addEmoji('1f596', ['detected']);
nodeOnly
Loads a dictionary of words to be used as filter.
NOTE: A US English default list located in the config directory is included and loaded by default.
swearjar.loadBadWords('./config/profanity.json');
A dictionary is just a plain JSON file containing an object where its keys are the words to check for and the values are arrays of categories where the words fall in.
{
"regex": {
"\\w*fuck\\w*": [
"category1",
"category2"
],
"word2": [
"category1"
],
"word3": [
"category2"
]
},
"simple": {
"word1": [
"category1",
"category2"
],
"word2": [
"category1"
],
"word3": [
"category2"
]
},
"emoji": {
"1f4a9": [
"category1",
"category2"
],
"word2": [
"category1"
],
"word3": [
"category2"
]
}
}
swearjar-node
is based on Swearjar (Ruby) and Swearjar PHP.
FAQs
Profanity detection and filtering library.
The npm package swearjar-extended receives a total of 31 weekly downloads. As such, swearjar-extended popularity was classified as not popular.
We found that swearjar-extended demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.