https://github.com/danielb2/blur
A library to modify and "blur" information in objects
https://github.com/danielb2/blur
Last synced: about 1 month ago
JSON representation
A library to modify and "blur" information in objects
- Host: GitHub
- URL: https://github.com/danielb2/blur
- Owner: danielb2
- Created: 2015-03-15T04:18:13.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-03-24T23:37:35.000Z (almost 11 years ago)
- Last Synced: 2025-11-23T21:14:30.832Z (3 months ago)
- Language: JavaScript
- Size: 199 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Blur
A library for filtering information from objects such as credit card information or other things which may be logged
## Usage
``` javascript
var obj = {
creditcard: {
number: 'ABCDEFGHIJKLMNOP',
year: 17,
month: 4
}
};
var result = Blur(obj, { number: Blur.creditCard });
```
Will result in
``` javascript
{
creditcard: {
number: 'XXXXXXXXXXXXMNOP',
year: 17,
month: 4
}
}
```
### `Blur(object, options)`
Recursively operate on keys in an object to censor, remove or modify values in
some way to make it safe for logging.
- `object` - Object to operated on
- `options` - object describing keys to be modified where:
- `` - name of key to be modified, and value is `type` of operation
to be performed.
#### Operation types:
- `Blur.creditCard` - This option is used to set any string to show only the last four characters and blur out the rest with X's
- `Blur.remove` - Completely removes all matching keys
- `Blur.censor` - Replaces all values matching keys with the string `[BLURRED]`