badwords-detector
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

badwords-detector

Do you need my help? Visit our Discord server.

NPM Downloads License

Node Version >= 16.16.0

Installation

npm i badwords-detector --save
# or
yarn add badwords-detector

Importing

// CJS
const { Detector } = require("badwords-detector");
const badwords = new Detector();

// ESM
import { Detector } from "badwords-detector";
const badwords = new Detector();

Usage

console.log(badwords.filter("I'm a badword!")); // String
console.log(badwords.detect("I'm a badword!")); // Boolean
/*
    Output:
        I'm a badword!
        false
*/

badwords.addWords("badword"); // String or Array

console.log(badwords.filter("I'm a badword!"));
console.log(badwords.detect("I'm a badword!"));
/*
    Output:
        I'm a ****!
        true
*/

// All Functions
badwords.filter(text: string) // Censore the badword
badwords.detect(text: string) // Detect the badword
badwords.addWords(...words: string[]) // Add a new word(s)
badwords.removeWords(...words: string[]) // Remove word(s)
badwords.setWords(...words: string[]) // Set words to [string]
badwords.clearWords() // Reset all words (with defaults)
badwords.getWords() // Get all words


Developed with ❤️ by clqu

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i badwords-detector

    Weekly Downloads

    1

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    24.1 kB

    Total Files

    7

    Last publish

    Collaborators

    • clqu