hebrew-censor
v1.0.0
Published
Package for censoring profane hebrew words
Downloads
4
Maintainers
Readme
Hebrew Censor
Hebrew censor is a library for censoring profane hebrew words.
Install
npm:
npm i hebrew-censor
yarn:
yarn add hebrew-censor
Usage
Filter Class / Standalone functions
import { Filter, censor, isWordProfane } from 'hebrew-censor';
const heFilter = new Filter();
const result = heFilter.censor('מה קורה ימניאק');
console.log(result); // מה קורה ******
const isProfane = heFilter.censor('מניאק');
console.log(isProfane); // true
const standaloneResult = censor('מה קורה ימניאק');
console.log(standaloneResult); // מה קורה ******
const standaloneIsProfane = heFilter.censor('מניאק');
console.log(standaloneIsProfane); // true
Using the Filter Class
gives you the advantage of customizing the filter
Click here for full filter init options
import { Filter } from 'hebrew-censor';
const heFilter = new Filter({ replacementSymbol: '!' });
const result = heFilter.censor('מה קורה ימניאק');
console.log(result); // מה קורה !!!!!!
heFilter.addBadWords('בלהבלה');
const secondResult = heFilter.censor('מה קורה בלהבלה');
console.log(secondResult); // מה קורה !!!!!!
heFilter.addToWhiteList('מניאק');
const thirdResult = heFilter.censor('מה קורה ימניאק');
console.log(thirdResult); // מה קורה ימניאק
Filter Class Init Options
const filterOptions = {
replacementSymbol: '*', // censor the words with this replacement symbol
freshStart: false, // wether or not to init profane words with empty array
extraWords: [], // add extra words to profane words list
whiteList: [], // add white list words that should not be considered profane
}
License
MIT © Yitzhakpro