redact( obj [, options] )
Deeply redact all the things
Installation
npm install --save rdct
Usage
redact(object)
import redact from 'rdct';
let obj = {
nested: {
arr: ['with', 'strings', 'in', 'the', 'array'],
mixed: ['with', false, ['and', 'deeply', 'nested', {stuff: 2}]],
num: -17772.11,
str: 'some long string',
blank: null,
missing: void 0,
regex: /test/i,
func: () => {}
}
};
console.log(redact(obj, {includeType: true, min: 3}));
Options
includeType
redact('lorem ipsum', {includeType: true})
redact(123.4222, {includeType: true})
redact(false, {includeType: true})
char
redact('lorem ipsum', {char: '?'})
redact(123.4222, {char: '^'})
redact(false, {char: '!'})
min
redact('lorem ipsum', {min: 15})
redact(123, {min: 3})
redact(true, {min: 2})