@carecard/validate 2.0.1 → 2.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/validate.js +60 -60
- package/package.json +1 -1
- package/coverage/clover.xml +0 -139
- package/coverage/coverage-final.json +0 -4
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -146
- package/coverage/lcov-report/index.ts.html +0 -91
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/validate.ts.html +0 -559
- package/coverage/lcov-report/validateProperties.ts.html +0 -370
- package/coverage/lcov.info +0 -378
- package/dist/cjs/index.cjs +0 -18
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/validate.cjs +0 -173
- package/dist/cjs/validate.d.ts +0 -25
- package/dist/cjs/validateProperties.cjs +0 -81
- package/dist/cjs/validateProperties.d.ts +0 -5
- package/dist/esm/index.d.ts +0 -2
- package/dist/esm/index.js +0 -2
- package/dist/esm/validate.d.ts +0 -25
- package/dist/esm/validate.js +0 -145
- package/dist/esm/validateProperties.d.ts +0 -5
- package/dist/esm/validateProperties.js +0 -78
package/coverage/lcov.info
DELETED
|
@@ -1,378 +0,0 @@
|
|
|
1
|
-
TN:
|
|
2
|
-
SF:src/index.ts
|
|
3
|
-
FNF:0
|
|
4
|
-
FNH:0
|
|
5
|
-
DA:1,2
|
|
6
|
-
DA:2,2
|
|
7
|
-
LF:2
|
|
8
|
-
LH:2
|
|
9
|
-
BRF:0
|
|
10
|
-
BRH:0
|
|
11
|
-
end_of_record
|
|
12
|
-
TN:
|
|
13
|
-
SF:src/validate.ts
|
|
14
|
-
FN:1,(anonymous_0)
|
|
15
|
-
FN:8,(anonymous_1)
|
|
16
|
-
FN:12,(anonymous_2)
|
|
17
|
-
FN:23,(anonymous_3)
|
|
18
|
-
FN:28,(anonymous_4)
|
|
19
|
-
FN:33,(anonymous_5)
|
|
20
|
-
FN:38,(anonymous_6)
|
|
21
|
-
FN:43,(anonymous_7)
|
|
22
|
-
FN:48,(anonymous_8)
|
|
23
|
-
FN:55,(anonymous_9)
|
|
24
|
-
FN:61,(anonymous_10)
|
|
25
|
-
FN:67,(anonymous_11)
|
|
26
|
-
FN:73,(anonymous_12)
|
|
27
|
-
FN:81,(anonymous_13)
|
|
28
|
-
FN:89,(anonymous_14)
|
|
29
|
-
FN:94,isPhoneNumber
|
|
30
|
-
FN:99,(anonymous_16)
|
|
31
|
-
FN:105,(anonymous_17)
|
|
32
|
-
FN:110,(anonymous_18)
|
|
33
|
-
FN:115,(anonymous_19)
|
|
34
|
-
FN:125,(anonymous_20)
|
|
35
|
-
FN:129,(anonymous_21)
|
|
36
|
-
FN:139,(anonymous_22)
|
|
37
|
-
FN:144,(anonymous_23)
|
|
38
|
-
FN:152,(anonymous_24)
|
|
39
|
-
FNF:25
|
|
40
|
-
FNH:25
|
|
41
|
-
FNDA:3,(anonymous_0)
|
|
42
|
-
FNDA:5,(anonymous_1)
|
|
43
|
-
FNDA:7,(anonymous_2)
|
|
44
|
-
FNDA:5,(anonymous_3)
|
|
45
|
-
FNDA:5,(anonymous_4)
|
|
46
|
-
FNDA:4,(anonymous_5)
|
|
47
|
-
FNDA:19,(anonymous_6)
|
|
48
|
-
FNDA:15,(anonymous_7)
|
|
49
|
-
FNDA:4,(anonymous_8)
|
|
50
|
-
FNDA:4,(anonymous_9)
|
|
51
|
-
FNDA:15,(anonymous_10)
|
|
52
|
-
FNDA:15,(anonymous_11)
|
|
53
|
-
FNDA:1,(anonymous_12)
|
|
54
|
-
FNDA:1,(anonymous_13)
|
|
55
|
-
FNDA:4,(anonymous_14)
|
|
56
|
-
FNDA:2,isPhoneNumber
|
|
57
|
-
FNDA:2,(anonymous_16)
|
|
58
|
-
FNDA:2,(anonymous_17)
|
|
59
|
-
FNDA:3,(anonymous_18)
|
|
60
|
-
FNDA:3,(anonymous_19)
|
|
61
|
-
FNDA:3,(anonymous_20)
|
|
62
|
-
FNDA:3,(anonymous_21)
|
|
63
|
-
FNDA:2,(anonymous_22)
|
|
64
|
-
FNDA:2,(anonymous_23)
|
|
65
|
-
FNDA:3,(anonymous_24)
|
|
66
|
-
DA:1,2
|
|
67
|
-
DA:2,3
|
|
68
|
-
DA:4,3
|
|
69
|
-
DA:5,3
|
|
70
|
-
DA:8,2
|
|
71
|
-
DA:9,5
|
|
72
|
-
DA:12,2
|
|
73
|
-
DA:13,7
|
|
74
|
-
DA:15,5
|
|
75
|
-
DA:16,5
|
|
76
|
-
DA:17,3
|
|
77
|
-
DA:19,2
|
|
78
|
-
DA:23,2
|
|
79
|
-
DA:24,5
|
|
80
|
-
DA:25,3
|
|
81
|
-
DA:28,2
|
|
82
|
-
DA:29,5
|
|
83
|
-
DA:30,3
|
|
84
|
-
DA:33,2
|
|
85
|
-
DA:34,4
|
|
86
|
-
DA:35,2
|
|
87
|
-
DA:38,2
|
|
88
|
-
DA:39,19
|
|
89
|
-
DA:40,19
|
|
90
|
-
DA:43,2
|
|
91
|
-
DA:44,15
|
|
92
|
-
DA:45,15
|
|
93
|
-
DA:48,2
|
|
94
|
-
DA:49,4
|
|
95
|
-
DA:51,4
|
|
96
|
-
DA:52,4
|
|
97
|
-
DA:55,2
|
|
98
|
-
DA:56,4
|
|
99
|
-
DA:57,4
|
|
100
|
-
DA:58,4
|
|
101
|
-
DA:61,2
|
|
102
|
-
DA:62,15
|
|
103
|
-
DA:63,15
|
|
104
|
-
DA:64,15
|
|
105
|
-
DA:67,2
|
|
106
|
-
DA:68,15
|
|
107
|
-
DA:69,15
|
|
108
|
-
DA:70,15
|
|
109
|
-
DA:73,2
|
|
110
|
-
DA:74,1
|
|
111
|
-
DA:75,1
|
|
112
|
-
DA:77,0
|
|
113
|
-
DA:81,2
|
|
114
|
-
DA:82,1
|
|
115
|
-
DA:83,1
|
|
116
|
-
DA:85,0
|
|
117
|
-
DA:89,2
|
|
118
|
-
DA:90,4
|
|
119
|
-
DA:91,4
|
|
120
|
-
DA:94,2
|
|
121
|
-
DA:95,2
|
|
122
|
-
DA:96,2
|
|
123
|
-
DA:99,2
|
|
124
|
-
DA:100,2
|
|
125
|
-
DA:101,2
|
|
126
|
-
DA:102,2
|
|
127
|
-
DA:105,2
|
|
128
|
-
DA:106,2
|
|
129
|
-
DA:107,2
|
|
130
|
-
DA:110,2
|
|
131
|
-
DA:111,3
|
|
132
|
-
DA:112,3
|
|
133
|
-
DA:115,2
|
|
134
|
-
DA:116,3
|
|
135
|
-
DA:118,3
|
|
136
|
-
DA:119,3
|
|
137
|
-
DA:122,0
|
|
138
|
-
DA:125,2
|
|
139
|
-
DA:126,3
|
|
140
|
-
DA:129,2
|
|
141
|
-
DA:130,3
|
|
142
|
-
DA:132,3
|
|
143
|
-
DA:133,3
|
|
144
|
-
DA:136,0
|
|
145
|
-
DA:139,2
|
|
146
|
-
DA:140,2
|
|
147
|
-
DA:141,2
|
|
148
|
-
DA:144,2
|
|
149
|
-
DA:145,2
|
|
150
|
-
DA:146,2
|
|
151
|
-
DA:149,0
|
|
152
|
-
DA:152,2
|
|
153
|
-
DA:153,3
|
|
154
|
-
DA:155,3
|
|
155
|
-
DA:157,3
|
|
156
|
-
LF:90
|
|
157
|
-
LH:85
|
|
158
|
-
BRDA:2,0,0,0
|
|
159
|
-
BRDA:2,0,1,3
|
|
160
|
-
BRDA:2,1,0,3
|
|
161
|
-
BRDA:2,1,1,3
|
|
162
|
-
BRDA:2,1,2,3
|
|
163
|
-
BRDA:13,2,0,2
|
|
164
|
-
BRDA:13,2,1,5
|
|
165
|
-
BRDA:13,3,0,7
|
|
166
|
-
BRDA:13,3,1,6
|
|
167
|
-
BRDA:13,3,2,5
|
|
168
|
-
BRDA:24,4,0,2
|
|
169
|
-
BRDA:24,4,1,3
|
|
170
|
-
BRDA:24,5,0,5
|
|
171
|
-
BRDA:24,5,1,4
|
|
172
|
-
BRDA:24,5,2,3
|
|
173
|
-
BRDA:29,6,0,2
|
|
174
|
-
BRDA:29,6,1,3
|
|
175
|
-
BRDA:29,7,0,5
|
|
176
|
-
BRDA:29,7,1,4
|
|
177
|
-
BRDA:29,7,2,3
|
|
178
|
-
BRDA:34,8,0,2
|
|
179
|
-
BRDA:34,8,1,2
|
|
180
|
-
BRDA:34,9,0,4
|
|
181
|
-
BRDA:34,9,1,3
|
|
182
|
-
BRDA:34,9,2,2
|
|
183
|
-
BRDA:39,10,0,0
|
|
184
|
-
BRDA:39,10,1,19
|
|
185
|
-
BRDA:39,11,0,19
|
|
186
|
-
BRDA:39,11,1,19
|
|
187
|
-
BRDA:39,11,2,19
|
|
188
|
-
BRDA:44,12,0,0
|
|
189
|
-
BRDA:44,12,1,15
|
|
190
|
-
BRDA:44,13,0,15
|
|
191
|
-
BRDA:44,13,1,15
|
|
192
|
-
BRDA:44,13,2,15
|
|
193
|
-
BRDA:49,14,0,0
|
|
194
|
-
BRDA:49,14,1,4
|
|
195
|
-
BRDA:49,15,0,4
|
|
196
|
-
BRDA:49,15,1,4
|
|
197
|
-
BRDA:49,15,2,4
|
|
198
|
-
BRDA:56,16,0,0
|
|
199
|
-
BRDA:56,16,1,4
|
|
200
|
-
BRDA:56,17,0,4
|
|
201
|
-
BRDA:56,17,1,4
|
|
202
|
-
BRDA:62,18,0,0
|
|
203
|
-
BRDA:62,18,1,15
|
|
204
|
-
BRDA:62,19,0,15
|
|
205
|
-
BRDA:62,19,1,15
|
|
206
|
-
BRDA:62,19,2,15
|
|
207
|
-
BRDA:68,20,0,0
|
|
208
|
-
BRDA:68,20,1,15
|
|
209
|
-
BRDA:68,21,0,15
|
|
210
|
-
BRDA:68,21,1,15
|
|
211
|
-
BRDA:68,21,2,15
|
|
212
|
-
BRDA:74,22,0,1
|
|
213
|
-
BRDA:74,22,1,0
|
|
214
|
-
BRDA:82,23,0,1
|
|
215
|
-
BRDA:82,23,1,0
|
|
216
|
-
BRDA:90,24,0,0
|
|
217
|
-
BRDA:90,24,1,4
|
|
218
|
-
BRDA:90,25,0,4
|
|
219
|
-
BRDA:90,25,1,4
|
|
220
|
-
BRDA:90,25,2,4
|
|
221
|
-
BRDA:95,26,0,0
|
|
222
|
-
BRDA:95,26,1,2
|
|
223
|
-
BRDA:95,27,0,2
|
|
224
|
-
BRDA:95,27,1,2
|
|
225
|
-
BRDA:95,27,2,2
|
|
226
|
-
BRDA:100,28,0,0
|
|
227
|
-
BRDA:100,28,1,2
|
|
228
|
-
BRDA:100,29,0,2
|
|
229
|
-
BRDA:100,29,1,2
|
|
230
|
-
BRDA:106,30,0,0
|
|
231
|
-
BRDA:106,30,1,2
|
|
232
|
-
BRDA:106,31,0,2
|
|
233
|
-
BRDA:106,31,1,2
|
|
234
|
-
BRDA:106,31,2,2
|
|
235
|
-
BRDA:107,32,0,2
|
|
236
|
-
BRDA:107,32,1,2
|
|
237
|
-
BRDA:111,33,0,0
|
|
238
|
-
BRDA:111,33,1,3
|
|
239
|
-
BRDA:111,34,0,3
|
|
240
|
-
BRDA:111,34,1,3
|
|
241
|
-
BRDA:111,34,2,3
|
|
242
|
-
BRDA:112,35,0,3
|
|
243
|
-
BRDA:112,35,1,3
|
|
244
|
-
BRDA:118,36,0,3
|
|
245
|
-
BRDA:118,36,1,0
|
|
246
|
-
BRDA:126,37,0,3
|
|
247
|
-
BRDA:126,37,1,3
|
|
248
|
-
BRDA:132,38,0,3
|
|
249
|
-
BRDA:132,38,1,0
|
|
250
|
-
BRDA:140,39,0,0
|
|
251
|
-
BRDA:140,39,1,2
|
|
252
|
-
BRDA:140,40,0,2
|
|
253
|
-
BRDA:140,40,1,2
|
|
254
|
-
BRDA:140,40,2,2
|
|
255
|
-
BRDA:145,41,0,2
|
|
256
|
-
BRDA:145,41,1,0
|
|
257
|
-
BRDA:153,42,0,0
|
|
258
|
-
BRDA:153,42,1,3
|
|
259
|
-
BRDA:153,43,0,3
|
|
260
|
-
BRDA:153,43,1,3
|
|
261
|
-
BRDA:153,43,2,3
|
|
262
|
-
BRF:104
|
|
263
|
-
BRH:85
|
|
264
|
-
end_of_record
|
|
265
|
-
TN:
|
|
266
|
-
SF:src/validateProperties.ts
|
|
267
|
-
FN:18,validateProperties
|
|
268
|
-
FNF:1
|
|
269
|
-
FNH:1
|
|
270
|
-
FNDA:9,validateProperties
|
|
271
|
-
DA:2,2
|
|
272
|
-
DA:18,2
|
|
273
|
-
DA:19,9
|
|
274
|
-
DA:21,9
|
|
275
|
-
DA:22,9
|
|
276
|
-
DA:33,1
|
|
277
|
-
DA:34,1
|
|
278
|
-
DA:37,4
|
|
279
|
-
DA:38,4
|
|
280
|
-
DA:41,1
|
|
281
|
-
DA:44,1
|
|
282
|
-
DA:46,0
|
|
283
|
-
DA:49,0
|
|
284
|
-
DA:51,0
|
|
285
|
-
DA:52,0
|
|
286
|
-
DA:54,0
|
|
287
|
-
DA:55,0
|
|
288
|
-
DA:59,0
|
|
289
|
-
DA:60,0
|
|
290
|
-
DA:70,1
|
|
291
|
-
DA:71,1
|
|
292
|
-
DA:73,0
|
|
293
|
-
DA:74,0
|
|
294
|
-
DA:78,0
|
|
295
|
-
DA:79,0
|
|
296
|
-
DA:81,0
|
|
297
|
-
DA:82,0
|
|
298
|
-
DA:86,2
|
|
299
|
-
DA:87,2
|
|
300
|
-
DA:89,0
|
|
301
|
-
DA:90,0
|
|
302
|
-
DA:94,9
|
|
303
|
-
LF:32
|
|
304
|
-
LH:16
|
|
305
|
-
BRDA:18,0,0,0
|
|
306
|
-
BRDA:21,1,0,9
|
|
307
|
-
BRDA:21,1,1,0
|
|
308
|
-
BRDA:22,2,0,1
|
|
309
|
-
BRDA:22,2,1,1
|
|
310
|
-
BRDA:22,2,2,1
|
|
311
|
-
BRDA:22,2,3,1
|
|
312
|
-
BRDA:22,2,4,1
|
|
313
|
-
BRDA:22,2,5,1
|
|
314
|
-
BRDA:22,2,6,1
|
|
315
|
-
BRDA:22,2,7,1
|
|
316
|
-
BRDA:22,2,8,1
|
|
317
|
-
BRDA:22,2,9,1
|
|
318
|
-
BRDA:22,2,10,2
|
|
319
|
-
BRDA:22,2,11,4
|
|
320
|
-
BRDA:22,2,12,1
|
|
321
|
-
BRDA:22,2,13,1
|
|
322
|
-
BRDA:22,2,14,0
|
|
323
|
-
BRDA:22,2,15,0
|
|
324
|
-
BRDA:22,2,16,0
|
|
325
|
-
BRDA:22,2,17,0
|
|
326
|
-
BRDA:22,2,18,0
|
|
327
|
-
BRDA:22,2,19,0
|
|
328
|
-
BRDA:22,2,20,0
|
|
329
|
-
BRDA:22,2,21,1
|
|
330
|
-
BRDA:22,2,22,1
|
|
331
|
-
BRDA:22,2,23,1
|
|
332
|
-
BRDA:22,2,24,1
|
|
333
|
-
BRDA:22,2,25,1
|
|
334
|
-
BRDA:22,2,26,1
|
|
335
|
-
BRDA:22,2,27,1
|
|
336
|
-
BRDA:22,2,28,1
|
|
337
|
-
BRDA:22,2,29,0
|
|
338
|
-
BRDA:22,2,30,0
|
|
339
|
-
BRDA:22,2,31,0
|
|
340
|
-
BRDA:22,2,32,0
|
|
341
|
-
BRDA:22,2,33,0
|
|
342
|
-
BRDA:22,2,34,0
|
|
343
|
-
BRDA:22,2,35,0
|
|
344
|
-
BRDA:22,2,36,2
|
|
345
|
-
BRDA:22,2,37,0
|
|
346
|
-
BRDA:33,3,0,1
|
|
347
|
-
BRDA:33,3,1,0
|
|
348
|
-
BRDA:37,4,0,2
|
|
349
|
-
BRDA:37,4,1,2
|
|
350
|
-
BRDA:41,5,0,1
|
|
351
|
-
BRDA:41,5,1,0
|
|
352
|
-
BRDA:41,6,0,1
|
|
353
|
-
BRDA:41,6,1,1
|
|
354
|
-
BRDA:46,7,0,0
|
|
355
|
-
BRDA:46,7,1,0
|
|
356
|
-
BRDA:46,8,0,0
|
|
357
|
-
BRDA:46,8,1,0
|
|
358
|
-
BRDA:51,9,0,0
|
|
359
|
-
BRDA:51,9,1,0
|
|
360
|
-
BRDA:54,10,0,0
|
|
361
|
-
BRDA:54,10,1,0
|
|
362
|
-
BRDA:59,11,0,0
|
|
363
|
-
BRDA:59,11,1,0
|
|
364
|
-
BRDA:70,12,0,1
|
|
365
|
-
BRDA:70,12,1,0
|
|
366
|
-
BRDA:73,13,0,0
|
|
367
|
-
BRDA:73,13,1,0
|
|
368
|
-
BRDA:78,14,0,0
|
|
369
|
-
BRDA:78,14,1,0
|
|
370
|
-
BRDA:81,15,0,0
|
|
371
|
-
BRDA:81,15,1,0
|
|
372
|
-
BRDA:86,16,0,2
|
|
373
|
-
BRDA:86,16,1,0
|
|
374
|
-
BRDA:89,17,0,0
|
|
375
|
-
BRDA:89,17,1,0
|
|
376
|
-
BRF:71
|
|
377
|
-
BRH:32
|
|
378
|
-
end_of_record
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./validate"), exports);
|
|
18
|
-
__exportStar(require("./validateProperties"), exports);
|
package/dist/cjs/index.d.ts
DELETED
package/dist/cjs/validate.cjs
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCountryCodeString = exports.isInStringArray = exports.isSafeString = exports.isPostalCodeString = exports.isBoolValue = exports.isProvinceString = exports.isString6To16CharacterLong = exports.isString6To24CharacterLong = exports.isUrlSafeString = exports.isUsernameString = exports.isSimplePasswordStringFailureMessage = exports.isPasswordStringFailureMessage = exports.isSimplePasswordString = exports.isPasswordString = exports.isJwtString = exports.isEmailString = exports.isSafeSearchString = exports.isNameString = exports.isCharactersString = exports.isValidUuidString = exports.isValidIntegerString = exports.isValidJsonString = exports.isInteger = exports.isImageUrl = void 0;
|
|
4
|
-
exports.isPhoneNumber = isPhoneNumber;
|
|
5
|
-
const isImageUrl = (imageUrl) => {
|
|
6
|
-
if (imageUrl === undefined || typeof imageUrl !== 'string' || imageUrl.length === 0)
|
|
7
|
-
return false;
|
|
8
|
-
const imageUrlRegex = /^[a-zA-Z0-9-_./]+$/;
|
|
9
|
-
return imageUrlRegex.test(imageUrl);
|
|
10
|
-
};
|
|
11
|
-
exports.isImageUrl = isImageUrl;
|
|
12
|
-
const isInteger = (number) => {
|
|
13
|
-
return Number.isInteger(number);
|
|
14
|
-
};
|
|
15
|
-
exports.isInteger = isInteger;
|
|
16
|
-
const isValidJsonString = (str) => {
|
|
17
|
-
if (str === undefined || typeof str !== 'string' || str.length === 0)
|
|
18
|
-
return false;
|
|
19
|
-
try {
|
|
20
|
-
const json = JSON.parse(str);
|
|
21
|
-
return typeof json === 'object';
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
exports.isValidJsonString = isValidJsonString;
|
|
28
|
-
const isValidIntegerString = (str) => {
|
|
29
|
-
if (str === undefined || typeof str !== 'string' || str.length === 0)
|
|
30
|
-
return false;
|
|
31
|
-
return /^\d+$/g.test(str);
|
|
32
|
-
};
|
|
33
|
-
exports.isValidIntegerString = isValidIntegerString;
|
|
34
|
-
const isValidUuidString = (str) => {
|
|
35
|
-
if (str === undefined || typeof str !== 'string' || str.length === 0)
|
|
36
|
-
return false;
|
|
37
|
-
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(str);
|
|
38
|
-
};
|
|
39
|
-
exports.isValidUuidString = isValidUuidString;
|
|
40
|
-
const isCharactersString = (str) => {
|
|
41
|
-
if (str === undefined || typeof str !== 'string' || str.length === 0)
|
|
42
|
-
return false;
|
|
43
|
-
return /^[\da-zA-Z _-]+$/.test(str);
|
|
44
|
-
};
|
|
45
|
-
exports.isCharactersString = isCharactersString;
|
|
46
|
-
const isNameString = (str) => {
|
|
47
|
-
if (str === undefined || typeof str !== 'string' || str.length === 0)
|
|
48
|
-
return false;
|
|
49
|
-
return /^[A-Za-z][0-9a-zA-Z-_.,'() ]+$/.test(str.trim());
|
|
50
|
-
};
|
|
51
|
-
exports.isNameString = isNameString;
|
|
52
|
-
const isSafeSearchString = (str) => {
|
|
53
|
-
if (str === undefined || typeof str !== 'string' || str.length === 0)
|
|
54
|
-
return false;
|
|
55
|
-
return /^[A-Za-z][0-9a-zA-Z\-_.,'()@ ]{1,100}$/.test(str.trim());
|
|
56
|
-
};
|
|
57
|
-
exports.isSafeSearchString = isSafeSearchString;
|
|
58
|
-
const isEmailString = (email) => {
|
|
59
|
-
if (email === undefined || typeof email !== 'string' || email.length === 0)
|
|
60
|
-
return false;
|
|
61
|
-
const regExpEmail = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
62
|
-
return regExpEmail.test(String(email).toLowerCase());
|
|
63
|
-
};
|
|
64
|
-
exports.isEmailString = isEmailString;
|
|
65
|
-
const isJwtString = (jwt) => {
|
|
66
|
-
if (jwt === '' || jwt.trim() === '')
|
|
67
|
-
return false;
|
|
68
|
-
const jwtRegex = /^eyJ[a-zA-Z0-9-_.]+$/;
|
|
69
|
-
return jwtRegex.test(jwt);
|
|
70
|
-
};
|
|
71
|
-
exports.isJwtString = isJwtString;
|
|
72
|
-
const isPasswordString = (password) => {
|
|
73
|
-
if (password === undefined || typeof password !== 'string' || password.length === 0)
|
|
74
|
-
return false;
|
|
75
|
-
const regExPassword = /^(?=.*[a-zA-Z0-9])(?=.*[!@#$%^&*_-])[a-zA-Z0-9!@#$%^&*_-]{6,32}$/;
|
|
76
|
-
return regExPassword.test(String(password));
|
|
77
|
-
};
|
|
78
|
-
exports.isPasswordString = isPasswordString;
|
|
79
|
-
const isSimplePasswordString = (password) => {
|
|
80
|
-
if (password === undefined || typeof password !== 'string' || password.length === 0)
|
|
81
|
-
return false;
|
|
82
|
-
const regExPassword = /^[a-zA-Z0-9!@#$%^&*_-]{6,32}$/;
|
|
83
|
-
return regExPassword.test(String(password));
|
|
84
|
-
};
|
|
85
|
-
exports.isSimplePasswordString = isSimplePasswordString;
|
|
86
|
-
const isPasswordStringFailureMessage = (password) => {
|
|
87
|
-
if (!(0, exports.isPasswordString)(password)) {
|
|
88
|
-
return 'Total 6 to 32 characters, numbers and one of !@#$%^&*_-';
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
exports.isPasswordStringFailureMessage = isPasswordStringFailureMessage;
|
|
95
|
-
const isSimplePasswordStringFailureMessage = (password) => {
|
|
96
|
-
if (!(0, exports.isPasswordString)(password)) {
|
|
97
|
-
return 'Total 6 to 32 characters, numbers or !@#$%^&*_-';
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
exports.isSimplePasswordStringFailureMessage = isSimplePasswordStringFailureMessage;
|
|
104
|
-
const isUsernameString = (str) => {
|
|
105
|
-
if (str === undefined || typeof str !== 'string' || str.length === 0)
|
|
106
|
-
return false;
|
|
107
|
-
return /^[0-9a-zA-Z]+$/.test(str);
|
|
108
|
-
};
|
|
109
|
-
exports.isUsernameString = isUsernameString;
|
|
110
|
-
function isPhoneNumber(str) {
|
|
111
|
-
if (str === undefined || typeof str !== 'string' || str.length === 0)
|
|
112
|
-
return false;
|
|
113
|
-
return /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/.test(str);
|
|
114
|
-
}
|
|
115
|
-
const isUrlSafeString = (inputString) => {
|
|
116
|
-
if (inputString === '' || inputString.trim() === '')
|
|
117
|
-
return false;
|
|
118
|
-
const jwtRegex = /^[a-zA-Z0-9-_.]+$/;
|
|
119
|
-
return jwtRegex.test(inputString);
|
|
120
|
-
};
|
|
121
|
-
exports.isUrlSafeString = isUrlSafeString;
|
|
122
|
-
const isString6To24CharacterLong = (password) => {
|
|
123
|
-
if (password === undefined || typeof password !== 'string' || password.length === 0)
|
|
124
|
-
return false;
|
|
125
|
-
return 6 <= password.length && password.length <= 24;
|
|
126
|
-
};
|
|
127
|
-
exports.isString6To24CharacterLong = isString6To24CharacterLong;
|
|
128
|
-
const isString6To16CharacterLong = (password) => {
|
|
129
|
-
if (password === undefined || typeof password !== 'string' || password.length === 0)
|
|
130
|
-
return false;
|
|
131
|
-
return 6 <= password.length && password.length <= 16;
|
|
132
|
-
};
|
|
133
|
-
exports.isString6To16CharacterLong = isString6To16CharacterLong;
|
|
134
|
-
const isProvinceString = (inputString) => {
|
|
135
|
-
const provinces = ['on', 'qc'];
|
|
136
|
-
if ((0, exports.isNameString)(inputString)) {
|
|
137
|
-
return provinces.includes(inputString.toLowerCase());
|
|
138
|
-
}
|
|
139
|
-
return false;
|
|
140
|
-
};
|
|
141
|
-
exports.isProvinceString = isProvinceString;
|
|
142
|
-
const isBoolValue = (inputValue) => {
|
|
143
|
-
return !(inputValue === undefined || typeof inputValue !== 'boolean');
|
|
144
|
-
};
|
|
145
|
-
exports.isBoolValue = isBoolValue;
|
|
146
|
-
const isPostalCodeString = (inputString) => {
|
|
147
|
-
const postalCodeRegex = /^(?!.*[DFIOQU])[A-VXY][0-9][A-Z] ?[0-9][A-Z][0-9]$/i;
|
|
148
|
-
if ((0, exports.isNameString)(inputString)) {
|
|
149
|
-
return postalCodeRegex.test(inputString);
|
|
150
|
-
}
|
|
151
|
-
return false;
|
|
152
|
-
};
|
|
153
|
-
exports.isPostalCodeString = isPostalCodeString;
|
|
154
|
-
const isSafeString = (str) => {
|
|
155
|
-
if (str === undefined || typeof str !== 'string' || str.length === 0)
|
|
156
|
-
return false;
|
|
157
|
-
return /^[\da-zA-Z-_.,#*'()\[\]: ]+$/.test(str);
|
|
158
|
-
};
|
|
159
|
-
exports.isSafeString = isSafeString;
|
|
160
|
-
const isInStringArray = (StringArray, inputString) => {
|
|
161
|
-
if ((0, exports.isNameString)(inputString)) {
|
|
162
|
-
return StringArray.includes(inputString.toLowerCase());
|
|
163
|
-
}
|
|
164
|
-
return false;
|
|
165
|
-
};
|
|
166
|
-
exports.isInStringArray = isInStringArray;
|
|
167
|
-
const isCountryCodeString = (str) => {
|
|
168
|
-
if (str === undefined || typeof str !== 'string' || str.length === 0)
|
|
169
|
-
return false;
|
|
170
|
-
const postalCodeRegex = /^\+[1-9][0-9]{0,2}$/i;
|
|
171
|
-
return postalCodeRegex.test(str);
|
|
172
|
-
};
|
|
173
|
-
exports.isCountryCodeString = isCountryCodeString;
|
package/dist/cjs/validate.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export declare const isImageUrl: (imageUrl: string | any[]) => boolean;
|
|
2
|
-
export declare const isInteger: (number: number | string) => boolean;
|
|
3
|
-
export declare const isValidJsonString: (str: string | number | any[]) => boolean;
|
|
4
|
-
export declare const isValidIntegerString: (str: string | number | any[]) => boolean;
|
|
5
|
-
export declare const isValidUuidString: (str: string | number | any[]) => boolean;
|
|
6
|
-
export declare const isCharactersString: (str: string | number | any[]) => boolean;
|
|
7
|
-
export declare const isNameString: (str: string) => boolean;
|
|
8
|
-
export declare const isSafeSearchString: (str: string) => boolean;
|
|
9
|
-
export declare const isEmailString: (email: string | any[]) => boolean;
|
|
10
|
-
export declare const isJwtString: (jwt: string) => boolean;
|
|
11
|
-
export declare const isPasswordString: (password: string | any[]) => boolean;
|
|
12
|
-
export declare const isSimplePasswordString: (password: string | any[]) => boolean;
|
|
13
|
-
export declare const isPasswordStringFailureMessage: (password: string | any[]) => "Total 6 to 32 characters, numbers and one of !@#$%^&*_-" | null;
|
|
14
|
-
export declare const isSimplePasswordStringFailureMessage: (password: string | any[]) => "Total 6 to 32 characters, numbers or !@#$%^&*_-" | null;
|
|
15
|
-
export declare const isUsernameString: (str: string | any[]) => boolean;
|
|
16
|
-
export declare function isPhoneNumber(str: string | any[]): boolean;
|
|
17
|
-
export declare const isUrlSafeString: (inputString: string) => boolean;
|
|
18
|
-
export declare const isString6To24CharacterLong: (password: string | any[]) => boolean;
|
|
19
|
-
export declare const isString6To16CharacterLong: (password: string | any[]) => boolean;
|
|
20
|
-
export declare const isProvinceString: (inputString: string) => boolean;
|
|
21
|
-
export declare const isBoolValue: (inputValue: any) => inputValue is boolean;
|
|
22
|
-
export declare const isPostalCodeString: (inputString: string) => boolean;
|
|
23
|
-
export declare const isSafeString: (str: string | any[]) => boolean;
|
|
24
|
-
export declare const isInStringArray: (StringArray: string | any[], inputString: string) => boolean;
|
|
25
|
-
export declare const isCountryCodeString: (str: string | any[]) => boolean;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateProperties = validateProperties;
|
|
4
|
-
// Validate the property values format.
|
|
5
|
-
const validate_1 = require("./validate");
|
|
6
|
-
function validateProperties(obj = {}) {
|
|
7
|
-
let returnObj = {};
|
|
8
|
-
for (let [key, value] of Object.entries(obj || {})) {
|
|
9
|
-
switch (key) {
|
|
10
|
-
case 'first_name':
|
|
11
|
-
case 'username':
|
|
12
|
-
case 'newStatus':
|
|
13
|
-
case 'description':
|
|
14
|
-
case 'comment':
|
|
15
|
-
case 'status':
|
|
16
|
-
case 'name':
|
|
17
|
-
case 'title':
|
|
18
|
-
case 'brand':
|
|
19
|
-
case 'short_description':
|
|
20
|
-
(0, validate_1.isNameString)(value) ? (returnObj[key] = value) : null;
|
|
21
|
-
break;
|
|
22
|
-
case 'search_string':
|
|
23
|
-
case 'searchString':
|
|
24
|
-
(0, validate_1.isSafeSearchString)(value) ? (returnObj[key] = value) : null;
|
|
25
|
-
break;
|
|
26
|
-
case 'password':
|
|
27
|
-
case 'new_password':
|
|
28
|
-
(0, validate_1.isString6To16CharacterLong)(value) && (0, validate_1.isSimplePasswordString)(value)
|
|
29
|
-
? (returnObj[key] = value)
|
|
30
|
-
: null;
|
|
31
|
-
break;
|
|
32
|
-
case 'strong_password':
|
|
33
|
-
(0, validate_1.isString6To16CharacterLong)(value) && (0, validate_1.isPasswordString)(value)
|
|
34
|
-
? (returnObj[key] = value)
|
|
35
|
-
: null;
|
|
36
|
-
break;
|
|
37
|
-
case 'email':
|
|
38
|
-
(0, validate_1.isEmailString)(value) ? (returnObj[key] = value) : null;
|
|
39
|
-
break;
|
|
40
|
-
case 'phone_number':
|
|
41
|
-
(0, validate_1.isPhoneNumber)(value) ? (returnObj[key] = value) : null;
|
|
42
|
-
break;
|
|
43
|
-
case 'token':
|
|
44
|
-
case 'email_confirm_token':
|
|
45
|
-
case 'verification_token':
|
|
46
|
-
(0, validate_1.isUrlSafeString)(value) ? (returnObj[key] = value) : null;
|
|
47
|
-
break;
|
|
48
|
-
case 'uuid':
|
|
49
|
-
case 'item_id':
|
|
50
|
-
case 'user_id':
|
|
51
|
-
case 'image_id':
|
|
52
|
-
case 'itemId':
|
|
53
|
-
case 'userId':
|
|
54
|
-
case 'orderId':
|
|
55
|
-
case 'category_id':
|
|
56
|
-
case 'parent_id':
|
|
57
|
-
(0, validate_1.isValidUuidString)(value) ? (returnObj[key] = value) : null;
|
|
58
|
-
break;
|
|
59
|
-
case 'period':
|
|
60
|
-
(0, validate_1.isCharactersString)(value) ? (returnObj[key] = value) : null;
|
|
61
|
-
break;
|
|
62
|
-
case 'offset_number':
|
|
63
|
-
case 'number_of_orders':
|
|
64
|
-
case 'price':
|
|
65
|
-
(0, validate_1.isValidIntegerString)(value) ? (returnObj[key] = value) : null;
|
|
66
|
-
break;
|
|
67
|
-
case 'about':
|
|
68
|
-
(0, validate_1.isValidJsonString)(value) ? (returnObj[key] = value.trim()) : null;
|
|
69
|
-
break;
|
|
70
|
-
case 'weight':
|
|
71
|
-
case 'dimensions':
|
|
72
|
-
case 'permission':
|
|
73
|
-
(0, validate_1.isValidJsonString)(JSON.stringify(value)) ? (returnObj[key] = value) : null;
|
|
74
|
-
break;
|
|
75
|
-
case 'image_url':
|
|
76
|
-
(0, validate_1.isImageUrl)(value) ? (returnObj[key] = value) : null;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return returnObj;
|
|
81
|
-
}
|
package/dist/esm/index.d.ts
DELETED
package/dist/esm/index.js
DELETED