New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

badwords-detector

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

badwords-detector

Advanced bad word filterer.

0.0.2
latest
Source
npm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

badwords

FAQs

Package last updated on 20 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts