Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
profanityfilter
Advanced tools
Readme
A static node.js utility for masking words or phrases in strings that aren't allowed.
npm install profanityfilter
There are three methods of replacement, outlined below ('word' requires you specify a replacement for each word):
stars - That **** UX change was such a pain in the ***
grawlix - That &!%$ UX change was such a pain in the #@%
word - That darn UX change was such a pain in the badonkadonk
Note: 'stars' is the default method of replacement
Takes supplied string and runs the filter based on the current dictionary of unallowed words and replacement method. Returns the filtered string.
var filter = require('profanity-filter');
console.log(filter.clean('String I\'d like to filter for inappropriate words.'));
Populates the internal filter dictionary using a seed data JSON file (must live in lib/seeds).
var filter = require('profanity-filter');
filter.seed('profanity');
###filter.debug()
Returns the dictionary, replacementMethod, and grawlixChars internal properties for debugging purposes.
var filter = require('profanity-filter');
filter.debug()
Globally sets the method of replacement. Accepts 'stars', 'word', and 'grawlix'.
var filter = require('profanity-filter');
filter.setReplacementMethod('grawlix');
Globally sets the grawlix characters to be used as replacements, if grawlix is the current replacementMethod.
var filter = require('profanity-filter');
filter.setGrawlixChars(['1', '2', '3', '4', '5', '6']);
Adds a word to the internal replacement dictionary. The optional second parameter is used if the replacementMethod is set to 'word'. If the word method is set and no replacement is passed, the filter will default to 'BLEEP'.
var filter = require('profanity-filter');
filter.addWord('ass', 'badonkadonk');
Removes a word from the internal replacement dicitonary.
var filter = require('profanity-filter');
filter.removeWord('ass');
FAQs
A node.js utility for masking words or phrases in strings that aren't allowed.
The npm package profanityfilter receives a total of 2 weekly downloads. As such, profanityfilter popularity was classified as not popular.
We found that profanityfilter 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
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.