masky is a simple, no-fuss, value masker.
masky automatically masks all values in an object, recursively.
masky allows you to omit "safe" values and even caters for emails.
masky doesn't offer much in the way of customisations, it's content being what it is.
const masky = require("masky");
const mySecrets = {
name: "Superman",
alias: "Clarke Kent",
contact: {
phone: "0123999911",
email: "[email protected]"
}
};
const safeSecrets = masky.mask(mySecrets, ["name"]);
console.log(safeSecrets);
{
"name": "Superman",
"alias": "C********t",
"contact": {
"phone": "0*******1",
"email": "c********[email protected]"
}
}
or mask a single value:
masky.maskString("04fad440-aae2-4596-b9cc-800204eaf8ac");
"04fad4e***********************af8ac"