maskdata 1.1.10 → 1.2.1

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.
@@ -0,0 +1,112 @@
1
+ ## Mask data for Typescript
2
+ The type definitions are bundled with the package. So, no need to install additional dependency. The type definitions are present here: https://github.com/Sumukha1496/maskdata/blob/master/index.d.ts
3
+
4
+ Only difference in using this package is with the import statements.
5
+
6
+ ### Example: Mask password functionality
7
+
8
+ ```javascript
9
+ import { maskPassword, PasswordMaskOptions } from 'maskdata';
10
+
11
+ const password: string = 'myPassword123';
12
+ const options: PasswordMaskOptions = {
13
+ maskWith: '*',
14
+ maxMaskedCharacters: 10,
15
+ unmaskedStartCharacters: 2,
16
+ unmaskedEndCharacters: 2
17
+ };
18
+
19
+ const maskedPassword = maskPassword(password, options);
20
+ console.log(maskedPassword);
21
+ ```
22
+ <br/>
23
+
24
+ ## Available mask configs/option
25
+ ### 1. PasswordMaskOptions
26
+ Used in [Password Masking](#mask-password)
27
+ ```javascript
28
+ {
29
+ maskWith?: string;
30
+ maxMaskedCharacters?: number;
31
+ unmaskedStartCharacters?: number;
32
+ unmaskedEndCharacters?: number;
33
+ }
34
+ ```
35
+
36
+ ### 2. CardMaskOptions
37
+ Used in [Card masking](./README.md#mask-card-number)
38
+ ```javascript
39
+ {
40
+ maskWith?: string;
41
+ unmaskedStartDigits?: number;
42
+ unmaskedEndDigits?: number;
43
+ }
44
+ ```
45
+
46
+ ### 3. EmailMask2Options
47
+ Used in [Email masking](./README.md#mask-email-id)
48
+ ```javascript
49
+ {
50
+ maskWith?: string;
51
+ unmaskedStartCharactersBeforeAt?: number;
52
+ unmaskedEndCharactersAfterAt?: number;
53
+ maskAtTheRate?: boolean;
54
+ }
55
+ ```
56
+
57
+ ### 4. PhoneMaskOptions
58
+ Used in [Phone Number Masking](#mask-phone-number)
59
+ ```javascript
60
+ {
61
+ maskWith?: string;
62
+ unmaskedStartDigits?: number;
63
+ unmaskedEndDigits?: number;
64
+ }
65
+ ```
66
+ ### 5. StringMaskOptions
67
+ Used in [String masking](./README.md#mask-the-characters-or-words-in-the-string)
68
+ ```javascript
69
+ {
70
+ maskWith?: string;
71
+ maskOnlyFirstOccurance?: boolean;
72
+ values?: string[];
73
+ maskAll?: boolean;
74
+ maskSpace?: boolean;
75
+ }
76
+ ```
77
+
78
+ ### 6. UuidMaskOptions
79
+ Used in [UUID Masking](#mask-uuid)
80
+ ```javascript
81
+ {
82
+ maskWith?: string;
83
+ unmaskedStartCharacters?: number;
84
+ unmaskedEndCharacters?: number;
85
+ }
86
+ ```
87
+
88
+ ### 7. JsonMask2Configs
89
+ Used in [JSON fields masking](#mask-json)
90
+ ```javascript
91
+ {
92
+ cardMaskOptions?: CardMaskOptions;
93
+ cardFields?: string[];
94
+ emailMaskOptions?: EmailMask2Options;
95
+ emailFields?: string[];
96
+ passwordMaskOptions?: PasswordMaskOptions;
97
+ passwordFields?: string[];
98
+ phoneMaskOptions?: PhoneMaskOptions;
99
+ phoneFields?: string[];
100
+ stringMaskOptions?: StringMaskOptions;
101
+ stringFields?: string[];
102
+ uuidMaskOptions?: UuidMaskOptions;
103
+ uuidFields?: string[];
104
+ }
105
+ ```
106
+
107
+ <br/>
108
+
109
+ ## Available functions to import along with their configs
110
+ ```javascript
111
+ import { maskPassword, PasswordMaskOptions, maskJSON2, JsonMask2Configs, maskPhone, PhoneMaskOptions, maskEmail2, EmailMask2Options, maskCard, CardMaskOptions, maskString, StringMaskOptions, maskUuid, UuidMaskOptions, getInnerProperty, replaceValue } from 'maskdata';
112
+ ```