maskdata 1.2.1 → 1.2.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/tests/scribble.js CHANGED
@@ -2,287 +2,459 @@ const MaskData = require('../index');
2
2
 
3
3
  const passwordMaskOptions = {
4
4
  maxMaskedCharacters: 10,
5
- maskWith: "X",
5
+ maskWith: 'X',
6
6
  unmaskedStartCharacters: 7,
7
7
  unmaskedEndCharacters: 3
8
8
  };
9
9
 
10
- const password = "Password1$";
11
- console.log(`Unmasked Password: ${password}` + " Length: " + password.length);
10
+ const password = 'Password1$';
11
+ console.log(`Unmasked Password: ${password}` + ' Length: ' + password.length);
12
12
  const maskedP = MaskData.maskPassword(password, passwordMaskOptions);
13
- console.log("Password after masking:" + maskedP + " Length: " + maskedP.length);
14
- console.log("========================================");
13
+ console.log('Password after masking:' + maskedP + ' Length: ' + maskedP.length);
14
+ console.log('========================================');
15
15
  const maskedPD = MaskData.maskPassword(password);
16
- console.log("Password after masking with default options:" + maskedPD + " Length: " + maskedPD.length);
17
- console.log("========================================");
18
-
16
+ console.log(
17
+ 'Password after masking with default options:' + maskedPD + ' Length: ' + maskedPD.length
18
+ );
19
+ console.log('========================================');
19
20
 
20
21
  const phoneMaskOptions = {
21
- maskWith: "*",
22
+ maskWith: '*',
22
23
  unmaskedStartDigits: 5,
23
24
  unmaskedEndDigits: 1
24
25
  };
25
26
 
26
- const phone = "+91123456789";
27
+ const phone = '+91123456789';
27
28
 
28
29
  console.log(`Unmasked phone: ${phone}`);
29
30
  console.log(`phone after masking: ${MaskData.maskPhone(phone, phoneMaskOptions)}`);
30
- console.log("========================================");
31
+ console.log('========================================');
31
32
  console.log(`phone after masking with default options: ${MaskData.maskPhone(phone)}`);
32
- console.log("========================================");
33
+ console.log('========================================');
33
34
 
34
35
  const emailMask2Options = {
35
- maskWith: "*",
36
+ maskWith: '*',
36
37
  unmaskedStartCharactersBeforeAt: 0,
37
38
  unmaskedEndCharactersAfterAt: 99,
38
39
  maskAtTheRate: false
39
40
  };
40
41
 
41
- console.log("========================================");
42
- const email = "my.testEmail@testMail.com";
42
+ console.log('========================================');
43
+ const email = 'my.testEmail@testMail.com';
43
44
  console.log(`Unmasked email: ${email}`);
44
45
  console.log(`Email after masking: ${MaskData.maskEmail2(email, emailMask2Options)}`);
45
- console.log("========================================");
46
+ console.log('========================================');
46
47
  console.log(`Email after masking with default options: ${MaskData.maskEmail2(email)}`);
47
- console.log("========================================");
48
+ console.log('========================================');
48
49
 
49
- console.log("========================================");
50
- const shortEmail = "a@b.c";
50
+ console.log('========================================');
51
+ const shortEmail = 'a@b.c';
51
52
  console.log(`Unmasked shortEmail: ${shortEmail}`);
52
53
  console.log(`shortEmail after masking: ${MaskData.maskEmail2(shortEmail, emailMask2Options)}`);
53
- console.log("========================================");
54
+ console.log('========================================');
54
55
 
55
56
  const jsonMaskOptions = {
56
57
  fields: ['password', 'firstName'],
57
58
  maxMaskedCharactersStr: 3
58
59
  };
59
60
  const json = {
60
- password: "PasswordValue",
61
- firstName: "FIRST_NAME",
62
- lastName: "LAST_NAME"
61
+ password: 'PasswordValue',
62
+ firstName: 'FIRST_NAME',
63
+ lastName: 'LAST_NAME'
63
64
  };
64
65
  console.log(`Unmasked object: `);
65
66
  console.log(JSON.stringify(json));
66
67
  console.log(`Object after masking:`);
67
68
  console.log(JSON.stringify(MaskData.maskJSONFields(json, jsonMaskOptions)));
68
- console.log("========================================");
69
+ console.log('========================================');
69
70
  console.log(JSON.stringify(json));
70
- console.log("========================================");
71
+ console.log('========================================');
71
72
  const jsonMaskOptions2 = {
72
- fields : ['level1.level2.level3.field3', 'level1.level2.field2', 'level1.field1', 'value1', 'level1.level2.level3.field4[0].Hello', 'level1.level2.level3.field4[2]']
73
+ fields: [
74
+ 'level1.level2.level3.field3',
75
+ 'level1.level2.field2',
76
+ 'level1.field1',
77
+ 'value1',
78
+ 'level1.level2.level3.field4[0].Hello',
79
+ 'level1.level2.level3.field4[2]'
80
+ ]
73
81
  };
74
82
  const maskAllFieldsOptions = {
75
- fields : ['level1.level2.field3[*].Hello', 'level1.level2.level3.*']
83
+ fields: ['level1.level2.field3[*].Hello', 'level1.level2.level3.*']
76
84
  };
77
85
  const nestedAllObject = {
78
86
  level1: {
79
- field1: "field1Value",
87
+ field1: 'field1Value',
80
88
  level2: {
81
- field2: "field2Value",
82
- field3: [ { Hello: "HelloValue", Hi: "one" }, { Hello: "Hello again" } ],
89
+ field2: 'field2Value',
90
+ field3: [{ Hello: 'HelloValue', Hi: 'one' }, { Hello: 'Hello again' }],
83
91
  level3: {
84
- field4: "field4Value",
85
- field5: "field5Value"
92
+ field4: 'field4Value',
93
+ field5: 'field5Value'
86
94
  }
87
95
  }
88
96
  },
89
- value1: "value"
97
+ value1: 'value'
90
98
  };
91
99
  console.log(`Unmasked nested object: `);
92
100
  console.log(JSON.stringify(nestedAllObject));
93
101
  console.log(`Nested Object after masking all:`);
94
102
  console.log(JSON.stringify(MaskData.maskJSONFields(nestedAllObject, maskAllFieldsOptions)));
95
- console.log("========================================");
103
+ console.log('========================================');
96
104
  const nestedObject = {
97
105
  level1: {
98
- field1: "field1",
106
+ field1: 'field1',
99
107
  level2: {
100
- field2: "field2",
108
+ field2: 'field2',
101
109
  level3: {
102
- field3: "field3",
103
- field4: [{ Hello: "world" }, { Hello: "Newworld" }, "Just a String"]
110
+ field3: 'field3',
111
+ field4: [{ Hello: 'world' }, { Hello: 'Newworld' }, 'Just a String']
104
112
  }
105
113
  }
106
114
  },
107
- value1: "value"
115
+ value1: 'value'
108
116
  };
109
117
  console.log(`Unmasked nested object: `);
110
118
  console.log(JSON.stringify(nestedObject));
111
119
  console.log(`Nested Object after masking:`);
112
120
  console.log(JSON.stringify(MaskData.maskJSONFields(nestedObject, jsonMaskOptions2)));
113
- console.log("========================================");
114
-
121
+ console.log('========================================');
115
122
 
116
123
  const stringMaskOptions = {
117
- maskWith: "*",
124
+ maskWith: '*',
118
125
  values: ['is', 'API']
119
126
  };
120
127
 
121
128
  const fullStringMaskOptions = {
122
- maskWith: "*",
129
+ maskWith: '*',
123
130
  values: ['is', 'API'],
124
131
  maskAll: true
125
132
  };
126
133
 
127
134
  const fullStringMaskOptionsWithoutSpace = {
128
- maskWith: "*",
135
+ maskWith: '*',
129
136
  values: ['is', 'API'],
130
137
  maskAll: true,
131
138
  maskSpace: false
132
139
  };
133
140
 
134
- let str = "This is a testingAPI String";
141
+ let str = 'This is a testingAPI String';
135
142
  console.log(`Unmasked string: ${str}`);
136
143
  console.log(`String after masking: ${MaskData.maskString(str, stringMaskOptions)}`);
137
- console.log("========================================");
144
+ console.log('========================================');
138
145
 
139
- str = "This is a testingAPI String";
146
+ str = 'This is a testingAPI String';
140
147
  stringMaskOptions.maskOnlyFirstOccurance = true;
141
148
  console.log(`Unmasked string: ${str}`);
142
- console.log(`String after masking entire string: ${MaskData.maskString(str, fullStringMaskOptions)}`);
143
- console.log("========================================");
149
+ console.log(
150
+ `String after masking entire string: ${MaskData.maskString(str, fullStringMaskOptions)}`
151
+ );
152
+ console.log('========================================');
144
153
 
145
- str = "This is a testingAPI String";
154
+ str = 'This is a testingAPI String';
146
155
  stringMaskOptions.maskOnlyFirstOccurance = true;
147
156
  console.log(`Unmasked string: ${str}`);
148
- console.log(`String after masking only first occurances: ${MaskData.maskString(str, stringMaskOptions)}`);
149
- console.log("========================================");
157
+ console.log(
158
+ `String after masking only first occurances: ${MaskData.maskString(str, stringMaskOptions)}`
159
+ );
160
+ console.log('========================================');
150
161
 
151
- str = "This is a testingAPI String";
162
+ str = 'This is a testingAPI String';
152
163
  stringMaskOptions.maskOnlyFirstOccurance = true;
153
164
  console.log(`Unmasked string: ${str}`);
154
- console.log(`String after masking entire string without spaces: ${MaskData.maskString(str, fullStringMaskOptionsWithoutSpace)}`);
155
- console.log("========================================");
165
+ console.log(
166
+ `String after masking entire string without spaces: ${MaskData.maskString(
167
+ str,
168
+ fullStringMaskOptionsWithoutSpace
169
+ )}`
170
+ );
171
+ console.log('========================================');
156
172
 
157
173
  const cardMaskOptions = {
158
- maskWith: "X",
174
+ maskWith: 'X',
159
175
  unmaskedStartDigits: 4,
160
176
  unmaskedEndDigits: 5
161
177
  };
162
178
 
163
- let cardNumber = "1234-5678-1234-5678";
179
+ let cardNumber = '1234-5678-1234-5678';
164
180
  console.log(`Unmasked cardNumber: ${cardNumber}`);
165
181
  console.log(`cardNumber after masking: ${MaskData.maskCard(cardNumber, cardMaskOptions)}`);
166
- console.log("========================================");
182
+ console.log('========================================');
167
183
 
168
184
  const nestedJson = {
169
185
  level1: {
170
- field1: "field1",
186
+ field1: 'field1',
171
187
  level2: {
172
- field2: "field2",
188
+ field2: 'field2',
173
189
  level3: {
174
- field3: "field3",
175
- field4: [ { Hello: "world" }, { Hello: "Newworld" }, "Just a String" ]
190
+ field3: 'field3',
191
+ field4: [{ Hello: 'world' }, { Hello: 'Newworld' }, 'Just a String']
176
192
  }
177
193
  }
178
194
  },
179
- value1: "value"
195
+ value1: 'value'
180
196
  };
181
197
  const field = 'level1.level2.level3.field4[0].Hello';
182
- console.log("========================================");
198
+ console.log('========================================');
183
199
  console.log(`${field}: ${MaskData.getInnerProperty(nestedJson, field)}`);
184
200
  const input = {
185
- name: "John",
201
+ name: 'John',
186
202
  age: 33,
187
203
  married: true
188
- }
189
- console.log("Before replacing: " + JSON.stringify(input));
190
- console.log("========================================");
204
+ };
205
+ console.log('Before replacing: ' + JSON.stringify(input));
206
+ console.log('========================================');
191
207
  let afterReplacing = MaskData.replaceValue(input, 'age', 99);
192
208
  afterReplacing = MaskData.replaceValue(input, 'married', false);
193
- console.log("After replacing: " + JSON.stringify(afterReplacing));
194
- console.log("Type of age: "+ typeof(afterReplacing.age));
195
- console.log("Type of married: "+ typeof(afterReplacing.married));
209
+ console.log('After replacing: ' + JSON.stringify(afterReplacing));
210
+ console.log('Type of age: ' + typeof afterReplacing.age);
211
+ console.log('Type of married: ' + typeof afterReplacing.married);
196
212
 
197
213
  const maskCardOptions = {
198
- maskWith: "*",
199
- unmaskedStartDigits: 4,
214
+ maskWith: '*',
215
+ unmaskedStartDigits: 4,
200
216
  unmaskedEndDigits: 4
201
217
  };
202
218
 
203
- const obj = { cardNumber: "123456789123" ,abc: "abceew" ,efg: "121212" } ;
204
- const result = MaskData.replaceValue(obj, 'cardNumber', MaskData.maskCard(obj['cardNumber'], maskCardOptions));
219
+ const obj = { cardNumber: '123456789123', abc: 'abceew', efg: '121212' };
220
+ const result = MaskData.replaceValue(
221
+ obj,
222
+ 'cardNumber',
223
+ MaskData.maskCard(obj['cardNumber'], maskCardOptions)
224
+ );
205
225
  console.log(result);
206
226
 
207
227
  const jsonInput = {
208
- 'credit': '1234-5678-8765-1234',
209
- 'debit': '0000-1111-2222-3333',
210
- 'primaryEmail': 'primary@Email.com',
211
- 'secondaryEmail': 'secondary@Email.com',
212
- 'password': 'dummyPassword',
213
- 'homePhone': "+1 1234567890",
214
- 'workPhone': "+1 9876543210",
215
- 'addressLine1': "This is my addressline 1. This is my home",
216
- 'addressLine2': "AddressLine 2",
217
- 'uuid1': '123e4567-e89b-12d3-a456-426614174000'
228
+ credit: '1234-5678-8765-1234',
229
+ debit: '0000-1111-2222-3333',
230
+ primaryEmail: 'primary@Email.com',
231
+ secondaryEmail: 'secondary@Email.com',
232
+ password: 'dummyPassword',
233
+ homePhone: '+1 1234567890',
234
+ workPhone: '+1 9876543210',
235
+ addressLine1: 'This is my addressline 1. This is my home',
236
+ addressLine2: 'AddressLine 2',
237
+ uuid1: '123e4567-e89b-12d3-a456-426614174000'
218
238
  };
219
239
 
220
240
  const jsonMaskConfig = {
221
- cardFields: ['credit', 'debit'],
222
- emailFields: ['primaryEmail', 'secondaryEmail'],
223
- passwordFields: ['password'],
224
- phoneFields: ['homePhone', 'workPhone'],
225
- stringMaskOptions: {
226
- maskWith: "*",
227
- maskOnlyFirstOccurance: false,
228
- values: ["This"]
229
- },
230
- stringFields: ['addressLine1', 'addressLine2'],
231
- uuidFields: ['uuid1']
241
+ cardFields: ['credit', 'debit'],
242
+ emailFields: ['primaryEmail', 'secondaryEmail'],
243
+ passwordFields: ['password'],
244
+ phoneFields: ['homePhone', 'workPhone'],
245
+ stringMaskOptions: {
246
+ maskWith: '*',
247
+ maskOnlyFirstOccurance: false,
248
+ values: ['This']
249
+ },
250
+ stringFields: ['addressLine1', 'addressLine2'],
251
+ uuidFields: ['uuid1']
232
252
  };
233
253
 
234
254
  const maskedJsonOutput = MaskData.maskJSON2(jsonInput, jsonMaskConfig);
235
255
  console.log(maskedJsonOutput);
236
256
 
237
-
238
257
  const jsonInput2 = {
239
258
  cards: {
240
259
  creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222'],
241
260
  debitCards: ['0000-1111-2222-3333', '2222-1111-3333-4444']
242
261
  },
243
262
  emails: {
244
- primaryEmail: 'primary@Email.com',
263
+ primaryEmail: 'primary@Email.com',
245
264
  secondaryEmail: 'secondary@Email.com'
246
265
  },
247
266
  passwords: [['dummyPasswordANDdummyPassword', 'dummyPasswordANDdummyPassword']],
248
267
  phones: {
249
- homePhone: "+1 1234567890",
250
- workPhone: "+1 9876543210",
268
+ homePhone: '+1 1234567890',
269
+ workPhone: '+1 9876543210'
251
270
  },
252
271
  address: {
253
- addressLine1: "This is my addressline 1. This is my home",
254
- addressLine2: "AddressLine 2"
272
+ addressLine1: 'This is my addressline 1. This is my home',
273
+ addressLine2: 'AddressLine 2'
255
274
  },
275
+ string1: [
276
+ {
277
+ id: '1111',
278
+ name: 'Test',
279
+ primaryEmail: 'primary@Email.com',
280
+ items: [
281
+ {
282
+ id: '11111',
283
+ passwords: ['dummyPasswordANDdummyPassword', 'dummyPasswordANDdummyPassword'],
284
+ creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222'],
285
+ phone: '+1 1234567890',
286
+ uuid1: '123e4567-e89b-12d3-a456-426614174000',
287
+ primaryEmail: 'primary@Email.com',
288
+ name: '11111',
289
+ child: [
290
+ {
291
+ child1: 'child1111111',
292
+ phone: '+1 1234567890',
293
+ passwords: ['dummyPasswordANDdummyPassword', 'dummyPasswordANDdummyPassword'],
294
+ primaryEmail: 'primary@Email.com',
295
+ creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222']
296
+ },
297
+ {
298
+ child1: 'child2222222',
299
+ creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222']
300
+ }
301
+ ]
302
+ },
303
+ {
304
+ id: '11112',
305
+ phone: '+1 1234567890',
306
+ name: '11112',
307
+ uuid1: '123e4567-e89b-12d3-a456-426614174000',
308
+ primaryEmail: 'primary@Email.com',
309
+ creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222'],
310
+ child: [
311
+ {
312
+ child1: 'child1111111',
313
+ passwords: ['dummyPasswordANDdummyPassword', 'dummyPasswordANDdummyPassword'],
314
+ primaryEmail: 'primary@Email.com',
315
+ creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222'],
316
+ uuid1: '123e4567-e89b-12d3-a456-426614174000',
317
+ phone: '+1 1234567890'
318
+ },
319
+ {
320
+ child1: 'child2222222',
321
+ primaryEmail: 'a@b.c',
322
+ creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222'],
323
+ phone: '+1 1234567890',
324
+ uuid1: '123e4567-e89b-12d3-a456-426614174000'
325
+ }
326
+ ]
327
+ }
328
+ ]
329
+ },
330
+ {
331
+ id: '2222',
332
+ name: 'Test',
333
+ items: [
334
+ {
335
+ id: '22221',
336
+ phone: '+1 1234567890',
337
+ passwords: ['dummyPasswordANDdummyPassword', 'dummyPasswordANDdummyPassword'],
338
+ name: '22221',
339
+ uuid1: '123e4567-e89b-12d3-a456-426614174000',
340
+ creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222'],
341
+ child: [
342
+ {
343
+ child1: 'child1111111',
344
+ phone: '+1 1234567890',
345
+ uuid1: '123e4567-e89b-12d3-a456-426614174000',
346
+ creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222']
347
+ },
348
+ {
349
+ child1: 'child2222222',
350
+ uuid1: '123e4567-e89b-12d3-a456-426614174000',
351
+ passwords: ['dummyPasswordANDdummyPassword', 'dummyPasswordANDdummyPassword'],
352
+ phone: '+1 1234567890',
353
+ creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222']
354
+ }
355
+ ]
356
+ },
357
+ {
358
+ id: '22222',
359
+ name: '22222',
360
+ phone: '+1 1234567890',
361
+ primaryEmail: 'primary@Email.com',
362
+ uuid1: '123e4567-e89b-12d3-a456-426614174000',
363
+ creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222'],
364
+ child: [
365
+ {
366
+ child1: 'child1111111',
367
+ phone: '+1 1234567890',
368
+ passwords: ['dummyPasswordANDdummyPassword', 'dummyPasswordANDdummyPassword'],
369
+ primaryEmail: 'primary@Email.com',
370
+ uuid1: '123e4567-e89b-12d3-a456-426614174000',
371
+ creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222']
372
+ },
373
+ {
374
+ child1: 'child2222222',
375
+ phone: '+1 1234567890',
376
+ passwords: ['dummyPasswordANDdummyPassword', 'dummyPasswordANDdummyPassword'],
377
+ uuid1: '123e4567-e89b-12d3-a456-426614174000',
378
+ creditCards: ['1234-5678-8765-1234', '1111-2222-1111-2222']
379
+ }
380
+ ]
381
+ }
382
+ ]
383
+ }
384
+ ],
256
385
  uuids: {
257
386
  uuid1: '123e4567-e89b-12d3-a456-426614174000'
258
387
  }
259
388
  };
260
389
 
261
390
  const jsonMaskConfig2 = {
262
- // Card
263
- cardMaskOptions: { maskWith: "X", unmaskedStartDigits: 2,unmaskedEndDigits: 4 },
264
- cardFields: ['cards.creditCards[0]', 'cards.creditCards[1]', 'cards.debitCards[0]', 'cards.debitCards[1]'],
265
-
266
- // Email
267
- emailMaskOptions: { maskWith: "*", unmaskedStartCharactersBeforeAt: 2, unmaskedEndCharactersAfterAt: 2, maskAtTheRate: false },
268
- emailFields: ['emails.primaryEmail', 'emails.secondaryEmail'],
269
-
270
- // Password
271
- passwordMaskOptions: { maskWith: "*", maxMaskedCharacters: 10, unmaskedStartCharacters: 0, unmaskedEndCharacters: 0 },
272
- passwordFields: ['passwords[0][0]]', 'passwords[0][1]'],
273
-
274
- // Phone
275
- phoneMaskOptions: { maskWith: "*", unmaskedStartDigits: 2, unmaskedEndDigits: 1 },
276
- phoneFields: ['phones.homePhone', 'phones.workPhone'],
277
-
278
- // String
279
- stringMaskOptions: { maskWith: "*", maskOnlyFirstOccurance: false, values: [], maskAll: true, maskSpace: false },
280
- stringFields: ['address.addressLine1', 'address.addressLine2'],
281
-
282
- // UUID
283
- uuidMaskOptions: { maskWith: "*", unmaskedStartCharacters: 4, unmaskedEndCharacters: 2 },
284
- uuidFields: ['uuids.uuid1']
391
+ cardMaskOptions: { maskWith: 'X', unmaskedStartDigits: 2, unmaskedEndDigits: 4 },
392
+ cardFields: [
393
+ 'string1[*].items[*].creditCards.*',
394
+ 'string1[*].items[*].child[*].creditCards.*',
395
+ 'cards.creditCards[0]',
396
+ 'cards.creditCards[1]',
397
+ 'cards.debitCards[0]',
398
+ 'cards.debitCards[1]'
399
+ ],
400
+
401
+ // Email
402
+ emailMaskOptions: {
403
+ maskWith: '*',
404
+ unmaskedStartCharactersBeforeAt: 2,
405
+ unmaskedEndCharactersAfterAt: 2,
406
+ maskAtTheRate: false
407
+ },
408
+ emailFields: [
409
+ 'string1[*].items[*].primaryEmail',
410
+ 'string1[*].items[*].child[*].primaryEmail',
411
+ 'string1[*].primaryEmail',
412
+ 'emails.primaryEmail',
413
+ 'emails.secondaryEmail'
414
+ ],
415
+
416
+ // Password
417
+ passwordMaskOptions: {
418
+ maskWith: '*',
419
+ maxMaskedCharacters: 10,
420
+ unmaskedStartCharacters: 0,
421
+ unmaskedEndCharacters: 0
422
+ },
423
+ passwordFields: [
424
+ 'passwords[0][0]]',
425
+ 'passwords[0][1]',
426
+ 'string1[*].items[*].passwords.*',
427
+ 'string1[*].items[*].child[*].passwords.*[1]'
428
+ ],
429
+
430
+ // Phone
431
+ phoneMaskOptions: { maskWith: '*', unmaskedStartDigits: 2, unmaskedEndDigits: 1 },
432
+ phoneFields: [
433
+ 'string1[*].items[*].phone',
434
+ 'string1[*].items[*].child[*].phone',
435
+ 'phones.homePhone',
436
+ 'phones.workPhone'
437
+ ],
438
+
439
+ // String
440
+ stringMaskOptions: {
441
+ maskWith: '*',
442
+ maskOnlyFirstOccurance: false,
443
+ values: [],
444
+ maskAll: true,
445
+ maskSpace: false
446
+ },
447
+ stringFields: [
448
+ 'string1[*].items[*].id',
449
+ 'string1[*].items[*].child[*].child1',
450
+ 'address.addressLine1',
451
+ 'address.addressLine2'
452
+ ],
453
+
454
+ // UUID
455
+ uuidMaskOptions: { maskWith: '*', unmaskedStartCharacters: 4, unmaskedEndCharacters: 2 },
456
+ uuidFields: ['uuids.uuid1', 'string1[*].items[*].uuid1', 'string1[*].items[*].child[*].uuid1']
285
457
  };
286
458
 
287
459
  const maskedJsonOutput2 = MaskData.maskJSON2(jsonInput2, jsonMaskConfig2);
288
- console.log(maskedJsonOutput2);
460
+ console.log(JSON.stringify(maskedJsonOutput2));