https://github.com/dakdevs/redakt-js
Recursively redact an object.
https://github.com/dakdevs/redakt-js
Last synced: 8 months ago
JSON representation
Recursively redact an object.
- Host: GitHub
- URL: https://github.com/dakdevs/redakt-js
- Owner: dakdevs
- Created: 2019-06-21T03:03:06.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T00:48:51.000Z (over 3 years ago)
- Last Synced: 2025-10-03T16:57:48.679Z (9 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/redakt
- Size: 269 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Redakt Object
## Installation
```bash
# With Yarn
yarn add redakt
# With NPM
npm install redakt
```
## Usage
```js
import redakt from 'redakt';
const objWithSecrets = {
password: 'THISISMYPASSWORD',
};
const redactedObject = redakt(objWithSecrets, {
enabled: true,
replace: '[REDACTED]',
keys: [
'password',
],
});
console.log(redactedObject);
// {
// password: '[REDACTED]'
// }
```
## Parameters
### Element `Object` or `JSON`
Redact's first parameter is the object or JSON string that you would like to recursively redact.
### Options `Object`
Redact's second parameter is the options object.
| Parameter | Type | Default | Description |
|---|---|---|---|
| `enabled` | `Boolean` | `true` | Enable or disable redaction. |
| `replace` | `String` | `"[REDACTED]"` | String to replace redacted values. |
| `keys` | `Array` | `[]` | List of keys to redact |