rude-filter
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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."

Package Sidebar

Install

npm i rude-filter

Weekly Downloads

19

Version

1.0.4

License

MIT

Unpacked Size

17.1 kB

Total Files

6

Last publish

Collaborators

  • ssakib4040