@go-mailer/jarvis 7.0.2 → 7.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utilitiy/text.js +15 -1
- package/package.json +1 -1
package/lib/utilitiy/text.js
CHANGED
|
@@ -14,4 +14,18 @@ const flattenObject = (object = {}, result = {}) => {
|
|
|
14
14
|
return { ...result, ...flattened_object };
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const scrambleSensitiveData = (SENSITIVE_DATA_KEYS = [], object = {}) => {
|
|
18
|
+
const scrambled_data = {};
|
|
19
|
+
for (const [key, value] of Object.entries(object)) {
|
|
20
|
+
scrambled_data[key] = value;
|
|
21
|
+
for (const piid_key of SENSITIVE_DATA_KEYS) {
|
|
22
|
+
if (key.toLowerCase().includes(piid_key.toLowerCase())) {
|
|
23
|
+
scrambled_data[key] = value.toString().replace(/\w/gi, "*");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return scrambled_data;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
module.exports = { flattenObject, scrambleSensitiveData };
|