Replace using function
Added the ability to use a function to replace the value.
Example:
const obj = {
firstname: 'Han',
lastname: 'Solo',
};
const replacer = val => `[ REDACTED (${val.length}) ]`;
const redacted = redact(obj, ['firstname', 'lastname'], replacer);
/**
* Results in:
* {
* firstname: '[ REDACTED (3) ]',
* lastname: '[ REDACTED (4) ]',
* };
*/Thanks @dylansmith for the suggestion!