-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.ts
28 lines (24 loc) · 903 Bytes
/
example.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import Obfuscator from "../dist/index";
const dirtyStringData = 'this is a string with Credit Card Number 4024-0071-4571-8614, CPF 222.222.222-22 with obfuscator';
const dirtyObjectData = {
password: 'this is a key',
Api_key: 'test string api_key',
teste: 'test string teste',
alguma: {
password: 'test string password',
teste: {
password: 'test string nested password',
obfuscator: 'test string obfuscator'
}
}
}
const obf = new Obfuscator({
replacerText: 'NOT_VISIBLE',
stringPatterns: [Obfuscator.EStringLookUpFields.CPF, Obfuscator.EStringLookUpFields.CREDIT_CARD],
additionalStringPatterns: [/obfuscator/],
additionalObjectKeys: ['obfuscator']
});
const clearDataObject = obf.blur(dirtyObjectData);
const clearDataString = obf.blur(dirtyStringData);
console.log(clearDataObject);
console.log(clearDataString);