Socket
Socket
Sign inDemoInstall

rude-filter

Package Overview
Dependencies
79
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rude-filter

RudeFilter is a lightweight TypeScript library for filtering out rude and offensive words from text. With RudeFilter, you can quickly and easily add a layer of content moderation to your application


Version published
Weekly downloads
3
decreased by-84.21%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Rude Filter

A simple module that filters rude words from a given text.

Installation

Install my-project with npm

  npm install rude-filter

or with yarn

  yarn add rude-filter

Usage/Examples

Adding and removing rude words

To add or remove rude words from the filter, use the following methods:

RudeFilter.addRudeWords(["word1", "word2", ...]);
RudeFilter.removeRudeWords(["word1", "word2", ...]);

Getting and clearing rude words

To get a list of the current rude words in the filter or to clear the filter, use the following methods:

RudeFilter.getRudeWords(); // Returns an array of the current rude words
RudeFilter.clearRudeWords(); // Removes all rude words

Filtering text

To filter text and replace any instances of rude words with a specified replacement string (default is "[censored]"), use the following method:

const text = "This is a rude and inappropriate message.";
const filteredText = RudeFilter.filter(text);

console.log(filteredText);
// Output: "This is a [censored] and [censored] message."

Filtering text with custom replacement string

To filter text and replace any instances of rude words with a custom replacement string, use the following method:

const text = "This is a rude and inappropriate message.";
const filteredText = RudeFilter.filter(text, "****");

console.log(filteredText);
// Output: "This is a **** and **** message."

Keywords

FAQs

Last updated on 11 Apr 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc