javascript - Masking sensitive information in node -
i want mask/hide json values not keys. ex:-
myobject = {"name":"value1","phoneno":"545454545445"} output should below: myobject = {"key1":***** ***,"key2":*****}
can please tell me, how can in nodejs? thanks.
how about:
let myobject = { "name": "value1", "phoneno": "545454545445" }; let output = {}; function mask(value: string) { let maskedvalue = ""; (let = 0; < value.length; i++) { maskedvalue += "*"; } return maskedvalue; } object.keys(myobject).foreach(key => { output[key] = mask(myobject[key]); }); console.log(output); // object {name: "******", phoneno: "************"}
Comments
Post a Comment