This package is for developers to be able to easily integrate bad word checking into their projects.\r This package can return bad words in array or regular expression (regex) form.
npm install badwordjs
shell
NPM
npm install badwordsjs
YARN
yarn add badwordsjs
`
Import
=====
CommonJS (Node)
`js
const { badWords } = require('badwordsjs');
`
ES6
`js
import { badWords } from 'badwordsjs';
`
Usage
=====
`js
const text = "Hey, don't be such an ass";
const lang = 'en'; // 'en' of 'vi'
badWords(text, { validate: true, lang });
// output: * offHey, don't be such an
badWords(text, { replacement: '*', lang });
// output: true
badWords(text, { replacement: '*', blacklist: (defaultList) => [...defaultList, "fuck", "don't"] });
// output: * offHey, ** be such an ass
badWords(text, { replacement: '*', lang }, (badwordsMatch, count) => console.log(badwordsMatch, count));
// output: [ 'Fuck', 'ass' ] 2
``