Profanease
A lightweight javascript detector and filter for profanity words / bad words written in typescript
- Works on ECMAScript all versions
- Support for multi language profanity detector and filter
Installation
Using npm:
$ npm i profanease$ npm i --save profanease
In Node.js:
var Profanease = ;//or
Example Usage
var isProfane = lang : 'all';//Multilingual support for word filtering//{lang : 'all'} represents all language word filter//Available language are ['ar','cs','da','en','eo','es','fa','fi','fr','hi','hu','it','ja','ko','nl','no','pl','pt','ru','sv','th','tlh','zh'] //profanity check returns boolenconsole; //true //profanity clean returns cleaned wordconsole; //Don't be an ******
Note: Default value for Profanease { lang : 'all', placeHolder: '*' }.
Placeholder Overrides
var isProfane = placeHolder: 'x';isProfane; //Don't be an xxxxxx
Regex Overrides
var isProfane = regex: /\*|\.|$/gi ;var isProfane = replaceRegex: /[A-Za-z0-9가-힣_]/g ;
Add words to the blacklist
var isProfane = ; isProfane;isProfane //**** *** ****!isProfane //true //or var isProfane = list: 'some' 'bad' 'word' ; isProfane //**** *** ****!isProfane //true
Instantiate with an empty list
var isProfane = emptyList: true ; isProfane; //hell this wont clean anythingisProfane; //false
Remove words from the blacklist
var isProfane = ; isProfane;isProfane; //some hells word!isProfane; //false
Exclude words from the profanity list
var isProfane = exclude: 'ash0le' ; isProfane; //Don't be an ash0leisProfane; //false
Export words list with language
var isProfane = ; isProfane; // [ "Asesinato", "*shit*"...]isProfane; // [ "*dyke", "*shit*"...]isProfane; // [ "Asesinato", "Bollera",..]// on error lang is 'all'