A simple utility function that sanitises specified object key values.
npm install sanitise[{key: 'secretkey': replaceWith: 'xxxxx'}]` ). This will return a function which takes the object you wish to sanitise, a new sanitised object is then returned.Example
`javascript
const sanitise = require('sanitise');const PROPERTIES_TO_SANITISE = [
{ key: 'name', replaceWith: '========' },
{ key: 'postcode', replaceWith: '--------' },
{ key: 'age' } // default replacement of "" will be used
];
const sanitiseData = sanitise(PROPERTIES_TO_SANITISE);
const TEST_DATA = {
name: '[this will be replaced]',
age: '[this will be replaced]',
nationality: 'british',
address: {
street1: '47 somewhere',
postcode: '[this will be replaced]'
}
};
let sanitisedObject = sanitiseData(TEST_DATA)
``