Skip to content

Commit

Permalink
docs(readme): update api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
web-mech committed Oct 23, 2018
1 parent f506659 commit b7d57eb
Showing 1 changed file with 12 additions and 35 deletions.
47 changes: 12 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -90,89 +88,68 @@ let removeWords = ['hells', 'sadist'];
filter.removeWords(...removeWords);

filter.clean("some sadist hells word!"); //some sadist hells word!

```
### API
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
#### 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.
**Parameters**
- `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;
**Parameters**
- `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.
**Parameters**
- `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
Expand Down

0 comments on commit b7d57eb

Please sign in to comment.