Mask sensitive values in a collection
$ npm install masked
import masked from 'masked';
const user = {
firstName: 'jake',
password: 'IAmCool',
mobileNumbers: ['0400123123', '0411223444'],
providerData: [{ providerNumber: '123456' }, { providerNumber: '123456' }]
};
const maskedUser = masked(user, ['password', 'mobileNumbers', 'providerData']);
/*
maskedUser =
{
firstName: 'jake',
password: '********',
mobileNumbers: ['********', '********'],
providerData: [{ providerNumber: '********' }, { providerNumber: '********' }]
}
*/
and here
Type: Object
or Array<Object>
The data that you want to mask.
Type: string
or Array
The sensitive keys in your data
.
Type: boolean
Default value: false
If true
, it will omit the keys completely from the data.
MIT ยฉ jxom