1.0.8 • Published 2 years ago
profanity-tools v1.0.8
About
Profanity tools is my first public package posted to the Node Package Manager. It is a simple tool that allows for the manipulation of strings containing profanity. Features include:
- Identifying profanic words in a string
- Censoring profanic words in a string
- Checking if a string is profanic
Installation
npm install profanity-tools
Example Usage
Identifying Profanity
const profanity = require("profanity-tools");
// Define test strings
const string = "F**k you"
// Identify any profanic words in a string
const result = profanity.identify(string);
/* This will return all the information about the string provided
{
"identified_profanity": [
{ "word": "F**k", "profanity_matches": ["F**k"] }
],
"isProfanic": true
}
*/
Checking for profanity
const profanity = require("profanity-tools");
// Define test strings
const string = "How are you?"
// Check if a string contains any profanity
const result = profanity.hasProfanity(string);
/* This will return a boolean value stating whether or not a string is profanic
false
*/
Censoring Profanity
const profanity = require("profanity-tools");
// Define test strings
const string = "Yippee ki-yay Mother Fu**er"
// Censor a string
const result = profanity.censor(string);
/* This will return a censored version of the string provided
"Yippee ki-yay Mother F****r"
*/