anti-swear

Split Bad Words Content With Easy Methods!

Usage no npm install needed!

<script type="module">
  import antiSwear from 'https://cdn.skypack.dev/anti-swear';
</script>

README

Supported languages:

Arabic, English

Installation:

npm install anti-swear@latest

Methods:

/* 1 */ split(content) // Split The Content Bad Words
/* 2 */ detect(content) // Detect The Content Bad Words And Return it With Array
/* 3 */ replace(symbol) // Customize The Symbol That Replaced With The Bad Words (Default "*")
/* 4 */ isContent(content) // if it's a Bad Word Return True.. Else Return False
/* 5 */ isNotContent(content) // if it's a Bad Word Return False.. Else Return True
/* 6 */ badWords(words) // Add Your Custom Denied Words
/* 7 */ ignore(words) // Remove The Words That You Like

Split Method:

const AntiSwear = require("anti-swear");
const antiSwear = new AntiSwear();

/* Split The Bad Words */
console.log(antiSwear.split("hi poops")); // ====> "hi ****s"
console.log(antiSwear.split("hello idiot")); // ====> "hello *****"

/* The Package Can Detect The Bad Words Between Symbols */
console.log(antiSwear.split("hi PO-oPs")); // ====> "hi ****s"
console.log(antiSwear.split("hello id!iot")); // ====> "hello *****"
console.log(antiSwear.split("hi p@$*)#&@(o$@&(*)/\"o@&($)'p-*)$)*@s")); // ====> "hi ****s"
//                              ^        ^        ^      ^
console.log(antiSwear.split("hello i;d!$!**(=3>i'8*#)@_o!^*@&t")); // ====> "hello *****"
//                                 ^ ^         ^       ^     ^

Detect Method:

const AntiSwear = require("anti-swear");
const antiSwear = new AntiSwear();

/* Detect The Bad Words And Return Array */
console.log(antiSwear.detect("hi i'm jehaad, and i'm so dumb")); // ====> [ 'dumb' ]
console.log(antiSwear.detect("hello sorry, i'm not an idiot and s?tu/$pi@d")); // ====> [ 'i+dio+t', 's?tu/$pi@d' ]

Replace Method:

const AntiSwear = require("anti-swear");
const antiSwear = new AntiSwear();

/* Set The Replace Symbol "#" */
antiSwear.replace("#")

/* Replace The Bad Words To The Replace Symbol */
console.log(antiSwear.split("hi poops")); // ====> "hi ####s"
console.log(antiSwear.split("hello idiot")); // ====> "hello #####"

/* Set The Replace Letters "ABC" */
antiSwear.replace("ABC")

/* Replace The Bad Words To The Replace Symbol */
console.log(antiSwear.split("hi poops")); // ====> "hi ABCABCABCABCs"
console.log(antiSwear.split("hello idiot")); // ====> "hello ABCABCABCABCABC"

isContent Method:

const AntiSwear = require("anti-swear");
const antiSwear = new AntiSwear();

/* Return False Because its Not Content Bad Words */
console.log(antiSwear.isContent("hello friend")); // ====> false

/* Return True Because its Content Bad Words */
console.log(antiSwear.isContent("hi poops")); // ====> true

isNotContent Method:

const AntiSwear = require("anti-swear");
const antiSwear = new AntiSwear();

/* Return True Because its Not Content Bad Words */
console.log(antiSwear.isNotContent("hello friend")); // ====> true

/* Return False Because its Content Bad Words */
console.log(antiSwear.isNotContent("hi poops")); // ====> false

BadWords Method:

const AntiSwear = require("anti-swear");
const antiSwear = new AntiSwear();

// Warning: This Method Adding Words/Emojis To The Default Bad words Array..
// It Not Makes a New Array!

/* Return False Because its Not Content Bad Words */
console.log(antiSwear.isContent("hi that's test1")); // ====> false

/* Adding "test1" & "test2" as a Bad Words */
antiSwear.badWords("test1", "test2")

/* Return True Because its Content Bad Words */
console.log(antiSwear.isContent("hi that's test1")); // ====> true
console.log(antiSwear.isContent("what's test2?")); // ====> true

Ignore Method:

const AntiSwear = require("anti-swear");
const antiSwear = new AntiSwear();

/* Return True Because its Content Bad Words */
console.log(antiSwear.isContent("hi i like poops")); // ====> true

/* Adding "poop" & "idiot" as Not a Bad Words */
antiSwear.ignore("poop", "idiot")

/* Return False Because its Not Content Bad Words */
console.log(antiSwear.isContent("poop")); // ====> false
console.log(antiSwear.isContent("idiot")); // ====> false