3.0.0 • Published 3 years ago
purgomalum-profanity v3.0.0
NOTE: READ MORE AT PurgoMalum.com
Install
npm i purgomalum-profanityUsage
Basic overview of usage
const Filter = require("purgomalum-profanity");
const filter = new Filter();
filter.clean("Hello a$$")
.then((cleanedText) => {
console.log(cleanedText); // Will log out "Hello ***"
});You can also use filter.containsProfanity() to check if it contains profanity.
filter.containsProfanity("Hello friend!")
.then((isBad) => {
console.log(isBad) // Will log out "false"
})If you perfer not to use promises, you can use await in async functions.
async function() {
var cleaned = await filter.clean("a$$");
}One of the coolest things about this filter, is that it doesn't always filter out substrings. For example:
await filter.containsProfanity("cock") // true
await filter.containsProfanity("cockpit") // falseYou can use the config object to create a new Filter, like this:
var config = {
fill_char: "~",
add: ["sussybaka"]
}
var filter = new Filter(config)Here is a short explanation about each of the Purgomalum configuration properties (from the official Purgomalum Website)
Note: You can only have either
fill_charorfill_text. You cannot have both.
Author
Devepation