anti-swear

    9.5.0 • Public • Published
    • Split Bad Words Content With Easy Methods!..

    Supported languages:

    Arabic, English

    NPM Installation:

    npm install anti-swear

    CDN Installation:

    <script src="https://cdn.jsdelivr.net/npm/anti-swear@latest/script.js"></script>

    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

    Install

    npm i anti-swear

    DownloadsWeekly Downloads

    7

    Version

    9.5.0

    License

    ISC

    Unpacked Size

    20.7 kB

    Total Files

    4

    Last publish

    Collaborators

    • jehaad