Skip to content

Commit

Permalink
Added docs about the new censor function. (#553)
Browse files Browse the repository at this point in the history
* Added docs about the new censor function.

* Update docs/api.md

Co-Authored-By: mcollina <matteo.collina@gmail.com>

* Update docs/api.md

Co-Authored-By: mcollina <matteo.collina@gmail.com>
  • Loading branch information
mcollina committed Nov 22, 2018
1 parent 045a557 commit c2173f8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/api.md
Expand Up @@ -105,7 +105,10 @@ Each path must be a string using a syntax which corresponds to JavaScript dot an

If an object is supplied, three options can be specified:
* `paths` (array): Required. An array of paths. See [redaction - Path Syntax ⇗](/docs/redaction.md#paths) for specifics.
* `censor` (String): Optional. A value to overwrite key which are to be redacted. Default: `'[Redacted]'`
* `censor` (String|Function|Undefined): Optional. When supplied as a String the `censor` option will overwrite keys which are to be redacted. When set to `undefined` the the key will be removed entirely from the object.
The `censor` option may also be a mapping function. The (synchronous) mapping function is called with the unredacted value. The value returned from the mapping function becomes the applied censor value. Default: `'[Redacted]'`
value synchronously.
Default: `'[Redacted]'`
* `remove` (Boolean): Optional. Instead of censoring the value, remove both the key and the value. Default: `false`

**WARNING**: Never allow user input to define redacted paths.
Expand Down

0 comments on commit c2173f8

Please sign in to comment.