1.0.1 • Published 4 years ago

sanitize-words v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

Sanitize Words

Remove undesirable words from input

Installation

npm install sanitize-words

Usage example

sanitizeWords(input, [options: {
    replacement: "-------", // string used to replace unwanted words
    custom: []. // an array of custom words to add to filter
    customOnly: false // if true, only the custom words will be filtered
}]);

Examples

const sanitizeWords = require("sanitize-words");

const words = "The quick brown fox jumped over the lazy dog.";

// Remove undesirable words using the included "badWords.txt" only
words = sanitizeWords(words);

// Remove undesirable words using both some custom input and the included bad words.
let custom = ["quick", "freaks"];

words = sanitizeWords(words, { custom });

For more examples and usage, please refer to the Wiki.

Development setup

Describe how to install all development dependencies and how to run an automated test-suite of some kind. Potentially do this for multiple platforms.

npm install

Release History

  • 1.0.0 initial release

Meta

Rane Wallin – @rane_wallin

Distributed under the MIT license. See LICENSE for more information.

https://github.com/RaneWallin

Contributing

  1. Fork it (https://github.com/RaneWallin/sanitize-words.git/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request