A javascript module for removing bad language from content.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
LICENSE
Makefile
README.md
badwords.json
index.js
package.json
textfinder.js

README.md

bad-language-filter

A node.js module for detecting, removing and replacing bad language from content.

Install with npm

npm install bad-language-filter --save

Initialize

var BadLanguageFilter = require('bad-language-filter');

var filter = new BadLanguageFilter();

Functions

contains

filter.contains("content");

The contains function will return true/false whether any of the bad words can be found in the content.

match

filter.match("content");

The match function will return the instances of the bad words to be found in the content.

removeWords

filter.removeWords("content");

The match function will remove the instances of the bad words to be found in the content.

replaceWords

filter.replaceWords("content", "replaceword");

The match function will replace the instances of the bad words with the given "replaceword" to be found in the content.

badwords.json contains the list of bad words that will be used to filter the content. You can change and update this, just remember to restart your app again.