diff --git a/README.md b/README.md index a196ab1..3b673c8 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,7 @@ As of version 2, requires you either have an environment that understands ES2016 ## Installation -``` -npm install bad-words -``` + npm install bad-words ## Usage @@ -90,27 +88,26 @@ let removeWords = ['hells', 'sadist']; filter.removeWords(...removeWords); filter.clean("some sadist hells word!"); //some sadist hells word! - ``` ### API -#### Filter +#### constructor Filter constructor. **Parameters** -- `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Filter instance options +- `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Filter instance options (optional, default `{}`) - `options.emptyList` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Instantiate filter with no blacklist - `options.list` **[array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** Instantiate filter with custom list - `options.placeHolder` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Character used to replace profane words. - `options.regex` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Regular expression used to sanitize words before comparing them to blacklist. - `options.replaceRegex` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Regular expression used to replace profane words with placeHolder. -##### isProfane +#### isProfane Determine if a string contains profane language. @@ -118,15 +115,7 @@ Determine if a string contains profane language. - `string` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** String to evaluate for profanity. -##### isProfaneLike - -Determine if a single word is profane or looks profane. - -**Parameters** - -- `word` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** String to evaluate for profanity. - -##### replaceWord +#### replaceWord Replace a word with placeHolder characters; @@ -134,7 +123,7 @@ Replace a word with placeHolder characters; - `string` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** String to replace. -##### clean +#### clean Evaluate a string for profanity and return an edited version. @@ -142,37 +131,25 @@ Evaluate a string for profanity and return an edited version. - `string` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Sentence to filter. -##### addWords +#### addWords -Add words to blacklist filter / remove words from whitelist filter +Add word(s) to blacklist filter / remove words from whitelist filter **Parameters** -- `words` +- `word` **...[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Word(s) to add to blacklist -##### removeWords +#### removeWords Add words to whitelist filter **Parameters** -- `word` **...[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Word to add to whitelist. +- `word` **...[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Word(s) to add to whitelist. ## Testing -``` -npm test -``` - -## Release Notes - -- v1.1.0 / Mar 17 2015: Added soundex support for comparing words to things not in the list. -- v1.2.0 / May 29 2015: Removed soundex logic which resulted in many false positives within the isProfane test. -- v1.3.0 / Oct 1 2015: Updated local list and documentation. Added ability to pass a custom list of words during construction. -- v1.4.0 / Sept 2 2016: Added removeWords feature. Added emptyList configuration parameter. -- v1.4.1 / Sept 2 2016: Updated documentation. -- v1.4.3 / Jan 21 2017: Add multilingual support for word filtering -- v1.5.1 / April 14 2017: Patch for word tokenization. + npm test ## License