hebrew-censor
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Hebrew Censor

Hebrew censor is a library for censoring profane hebrew words.

NPM

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

Dependents (0)

Package Sidebar

Install

npm i hebrew-censor

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

15.8 kB

Total Files

19

Last publish

Collaborators

  • yitzhakpro