fullstack-phone 1.148.0 → 1.150.0
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/CHANGELOG.md +11 -1
- package/README.md +1 -1
- package/client/index.d.ts +143 -0
- package/package.json +2 -2
- package/server/index.d.ts +483 -0
- package/server/metadata/metadata.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.150.0
|
|
4
|
+
|
|
5
|
+
* Metadata:
|
|
6
|
+
* Updated to libphonenumber v8.13.33
|
|
7
|
+
|
|
8
|
+
## 1.149.0
|
|
9
|
+
|
|
10
|
+
* Added Typescript declaration files
|
|
11
|
+
|
|
3
12
|
## 1.148.0
|
|
4
13
|
|
|
5
14
|
* Metadata:
|
|
6
15
|
* Updated to libphonenumber v8.13.32
|
|
7
16
|
|
|
8
17
|
## 1.147.1
|
|
18
|
+
|
|
9
19
|
* Bugfix:
|
|
10
|
-
*
|
|
20
|
+
* Restored `client/index.js` to ES5 (was generated with ESNEXT in v1.142.0)
|
|
11
21
|
|
|
12
22
|
## 1.147.0
|
|
13
23
|
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ fullstack-phone ☎️
|
|
|
3
3
|
|
|
4
4
|
| npm | Libphonenumber version |
|
|
5
5
|
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|
|
6
|
-
| [](https://www.npmjs.com/package/fullstack-phone) | [v8.13.
|
|
6
|
+
| [](https://www.npmjs.com/package/fullstack-phone) | [v8.13.33](https://github.com/googlei18n/libphonenumber/blob/master/release_notes.txt) |
|
|
7
7
|
|
|
8
8
|
**fullstack-phone** provides formatting, validation, and parsing of phone numbers per-region. The system is optimized for use as two modules:
|
|
9
9
|
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
RegionCode,
|
|
3
|
+
Meta,
|
|
4
|
+
CountryCallingCodeNumeric,
|
|
5
|
+
CountryCodeToRegionCodeMap,
|
|
6
|
+
} from '../server';
|
|
7
|
+
|
|
8
|
+
interface PhoneObj {
|
|
9
|
+
countryCode: string;
|
|
10
|
+
nationalNumber: string;
|
|
11
|
+
extension?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type PhoneNumberType =
|
|
15
|
+
| 'FIXED_LINE'
|
|
16
|
+
| 'MOBILE'
|
|
17
|
+
| 'FIXED_LINE_OR_MOBILE'
|
|
18
|
+
| 'TOLL_FREE'
|
|
19
|
+
| 'PREMIUM_RATE'
|
|
20
|
+
| 'SHARED_COST'
|
|
21
|
+
| 'VOIP'
|
|
22
|
+
| 'PERSONAL_NUMBER'
|
|
23
|
+
| 'PAGER'
|
|
24
|
+
| 'UAN'
|
|
25
|
+
| 'VOICEMAIL'
|
|
26
|
+
| 'UNKNOWN';
|
|
27
|
+
|
|
28
|
+
interface FormatOptions {
|
|
29
|
+
style: 'e164' | 'international' | 'national' | 'rfc3966';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type FullPhoneValidationErrorMessage = 'PHONE_INVALID_FOR_REGION'
|
|
33
|
+
| 'PHONE_INVALID_COUNTRY_CODE'
|
|
34
|
+
| 'PHONE_NUMBER_TOO_LONG'
|
|
35
|
+
| 'PHONE_NUMBER_TOO_SHORT'
|
|
36
|
+
| 'PHONE_NUMBER_INVALID_LENGTH';
|
|
37
|
+
|
|
38
|
+
interface FullValidationError extends Error {
|
|
39
|
+
message: FullPhoneValidationErrorMessage;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface LengthValidationError extends Error {
|
|
43
|
+
message: FullPhoneValidationErrorMessage | 'PHONE_NUMBER_POSSIBLE_LOCAL_ONLY';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface ParseError extends Error {
|
|
47
|
+
message:
|
|
48
|
+
| 'PHONE_INVALID_COUNTRY_CODE'
|
|
49
|
+
| 'PHONE_NUMBER_TOO_SHORT'
|
|
50
|
+
| 'PHONE_NUMBER_TOO_LONG'
|
|
51
|
+
| 'PHONE_NOT_A_NUMBER'
|
|
52
|
+
| 'PHONE_TOO_SHORT_AFTER_IDD';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface PhoneHandler {
|
|
56
|
+
/**
|
|
57
|
+
* Return the list of region codes supported by the loaded metadata
|
|
58
|
+
*/
|
|
59
|
+
getSupportedRegions: () => Array<RegionCode>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Return the country calling code for a particular region code
|
|
63
|
+
*/
|
|
64
|
+
getCountryCodeForRegion: (regionCode: RegionCode) => CountryCallingCodeNumeric;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Return a map of country calling codes to arrays of regions
|
|
68
|
+
*/
|
|
69
|
+
countryCodeToRegionCodeMap: () => CountryCodeToRegionCodeMap;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Return the type of a (valid) phone number
|
|
73
|
+
*/
|
|
74
|
+
inferPhoneNumberType: (phoneObj: PhoneObj) => PhoneNumberType;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Return the region of a (valid) phone number
|
|
78
|
+
* or null if the region cannot be determined
|
|
79
|
+
*/
|
|
80
|
+
inferPhoneNumberRegion: (phoneObj: PhoneObj) => RegionCode | null;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Format a phone number according to the given style
|
|
84
|
+
*/
|
|
85
|
+
formatPhoneNumber: (phoneObj: PhoneObj, options: FormatOptions) => string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Indicate whether the given phone number is valid for the given region
|
|
89
|
+
* If regionCode is omitted, the phone number is checked against all possible regions loaded in the metadata
|
|
90
|
+
*/
|
|
91
|
+
validatePhoneNumber: (phoneObj: PhoneObj, regionCode?: RegionCode) => true | FullValidationError;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Indicate whether the given phone number is "possible" for the region (i.e., whether it adheres to length constraints)
|
|
95
|
+
* (More lenient than validatePhoneNumber)
|
|
96
|
+
* If regionCode is omitted, it is checked against all regions loaded in the metadata
|
|
97
|
+
*/
|
|
98
|
+
validateLength: (phoneObj: PhoneObj, regionCode?: RegionCode) => true | LengthValidationError;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Parse a phone number string for the given region and return a phoneObj
|
|
102
|
+
*/
|
|
103
|
+
parsePhoneNumber: (phoneNumberToParse: string, regionCode?: RegionCode) => PhoneObj | ParseError;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Return an example phone number for a given type and region
|
|
107
|
+
* or null if an example does not exist
|
|
108
|
+
*/
|
|
109
|
+
getExampleNumberForType: (type: PhoneNumberType, regionCode: RegionCode) => PhoneObj | null;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Return an as-you-type formatter instantiated for the given region
|
|
113
|
+
*/
|
|
114
|
+
getAsYouTypeFormatter: (regionCode: RegionCode) => AsYouTypeFormatter;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface AsYouTypeFormatter {
|
|
118
|
+
/**
|
|
119
|
+
* Input a single character
|
|
120
|
+
* Returns the formatted output so far
|
|
121
|
+
*/
|
|
122
|
+
inputDigit: (x: number | string) => string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Clear the formatter
|
|
126
|
+
*/
|
|
127
|
+
clear: () => void;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Input a single char and remember the position
|
|
131
|
+
*/
|
|
132
|
+
inputDigitAndRememberPosition: (x: number | string) => string;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Return the remembered position as a number
|
|
136
|
+
*/
|
|
137
|
+
getRememberedPosition: () => number;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Return a phone handler initialized for the given metadata bundle
|
|
142
|
+
*/
|
|
143
|
+
export function createPhoneHandler(meta: Meta): PhoneHandler;
|
package/package.json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119
|
+
| 'KM'
|
|
120
|
+
| 'KN'
|
|
121
|
+
| 'KP'
|
|
122
|
+
| 'KR'
|
|
123
|
+
| 'KW'
|
|
124
|
+
| 'KY'
|
|
125
|
+
| 'KZ'
|
|
126
|
+
| 'RU'
|
|
127
|
+
| 'LA'
|
|
128
|
+
| 'LB'
|
|
129
|
+
| 'LC'
|
|
130
|
+
| 'LI'
|
|
131
|
+
| 'LK'
|
|
132
|
+
| 'LR'
|
|
133
|
+
| 'LS'
|
|
134
|
+
| 'LT'
|
|
135
|
+
| 'LU'
|
|
136
|
+
| 'LV'
|
|
137
|
+
| 'LY'
|
|
138
|
+
| 'MC'
|
|
139
|
+
| 'MD'
|
|
140
|
+
| 'ME'
|
|
141
|
+
| 'MF'
|
|
142
|
+
| 'MG'
|
|
143
|
+
| 'MH'
|
|
144
|
+
| 'MK'
|
|
145
|
+
| 'ML'
|
|
146
|
+
| 'MM'
|
|
147
|
+
| 'MN'
|
|
148
|
+
| 'MO'
|
|
149
|
+
| 'MP'
|
|
150
|
+
| 'MQ'
|
|
151
|
+
| 'MR'
|
|
152
|
+
| 'MS'
|
|
153
|
+
| 'MT'
|
|
154
|
+
| 'MU'
|
|
155
|
+
| 'MV'
|
|
156
|
+
| 'MW'
|
|
157
|
+
| 'MX'
|
|
158
|
+
| 'MY'
|
|
159
|
+
| 'MZ'
|
|
160
|
+
| 'NA'
|
|
161
|
+
| 'NC'
|
|
162
|
+
| 'NE'
|
|
163
|
+
| 'NF'
|
|
164
|
+
| 'NG'
|
|
165
|
+
| 'NI'
|
|
166
|
+
| 'NL'
|
|
167
|
+
| 'NO'
|
|
168
|
+
| 'NP'
|
|
169
|
+
| 'NR'
|
|
170
|
+
| 'NU'
|
|
171
|
+
| 'NZ'
|
|
172
|
+
| 'OM'
|
|
173
|
+
| 'PA'
|
|
174
|
+
| 'PE'
|
|
175
|
+
| 'PF'
|
|
176
|
+
| 'PG'
|
|
177
|
+
| 'PH'
|
|
178
|
+
| 'PK'
|
|
179
|
+
| 'PL'
|
|
180
|
+
| 'PM'
|
|
181
|
+
| 'PR'
|
|
182
|
+
| 'PS'
|
|
183
|
+
| 'PT'
|
|
184
|
+
| 'PW'
|
|
185
|
+
| 'PY'
|
|
186
|
+
| 'QA'
|
|
187
|
+
| 'RE'
|
|
188
|
+
| 'RO'
|
|
189
|
+
| 'RS'
|
|
190
|
+
| 'RW'
|
|
191
|
+
| 'SA'
|
|
192
|
+
| 'SB'
|
|
193
|
+
| 'SC'
|
|
194
|
+
| 'SD'
|
|
195
|
+
| 'SE'
|
|
196
|
+
| 'SG'
|
|
197
|
+
| 'SH'
|
|
198
|
+
| 'SI'
|
|
199
|
+
| 'SJ'
|
|
200
|
+
| 'SK'
|
|
201
|
+
| 'SL'
|
|
202
|
+
| 'SM'
|
|
203
|
+
| 'SN'
|
|
204
|
+
| 'SO'
|
|
205
|
+
| 'SR'
|
|
206
|
+
| 'SS'
|
|
207
|
+
| 'ST'
|
|
208
|
+
| 'SV'
|
|
209
|
+
| 'SX'
|
|
210
|
+
| 'SY'
|
|
211
|
+
| 'SZ'
|
|
212
|
+
| 'TA'
|
|
213
|
+
| 'TC'
|
|
214
|
+
| 'TD'
|
|
215
|
+
| 'TG'
|
|
216
|
+
| 'TH'
|
|
217
|
+
| 'TJ'
|
|
218
|
+
| 'TK'
|
|
219
|
+
| 'TL'
|
|
220
|
+
| 'TM'
|
|
221
|
+
| 'TN'
|
|
222
|
+
| 'TO'
|
|
223
|
+
| 'TR'
|
|
224
|
+
| 'TT'
|
|
225
|
+
| 'TV'
|
|
226
|
+
| 'TW'
|
|
227
|
+
| 'TZ'
|
|
228
|
+
| 'UA'
|
|
229
|
+
| 'UG'
|
|
230
|
+
| 'UY'
|
|
231
|
+
| 'UZ'
|
|
232
|
+
| 'VA'
|
|
233
|
+
| 'VC'
|
|
234
|
+
| 'VE'
|
|
235
|
+
| 'VG'
|
|
236
|
+
| 'VI'
|
|
237
|
+
| 'VN'
|
|
238
|
+
| 'VU'
|
|
239
|
+
| 'WF'
|
|
240
|
+
| 'WS'
|
|
241
|
+
| 'XK'
|
|
242
|
+
| 'YE'
|
|
243
|
+
| 'YT'
|
|
244
|
+
| 'ZA'
|
|
245
|
+
| 'ZM'
|
|
246
|
+
| 'ZW'
|
|
247
|
+
| 'PN'
|
|
248
|
+
| 'AN'
|
|
249
|
+
| '001';
|
|
250
|
+
|
|
251
|
+
export type CountryCallingCodeNumeric =
|
|
252
|
+
| 1
|
|
253
|
+
| 7
|
|
254
|
+
| 20
|
|
255
|
+
| 27
|
|
256
|
+
| 30
|
|
257
|
+
| 31
|
|
258
|
+
| 32
|
|
259
|
+
| 33
|
|
260
|
+
| 34
|
|
261
|
+
| 36
|
|
262
|
+
| 39
|
|
263
|
+
| 40
|
|
264
|
+
| 41
|
|
265
|
+
| 43
|
|
266
|
+
| 44
|
|
267
|
+
| 45
|
|
268
|
+
| 46
|
|
269
|
+
| 47
|
|
270
|
+
| 48
|
|
271
|
+
| 49
|
|
272
|
+
| 51
|
|
273
|
+
| 52
|
|
274
|
+
| 53
|
|
275
|
+
| 54
|
|
276
|
+
| 55
|
|
277
|
+
| 56
|
|
278
|
+
| 57
|
|
279
|
+
| 58
|
|
280
|
+
| 60
|
|
281
|
+
| 61
|
|
282
|
+
| 62
|
|
283
|
+
| 63
|
|
284
|
+
| 64
|
|
285
|
+
| 65
|
|
286
|
+
| 66
|
|
287
|
+
| 81
|
|
288
|
+
| 82
|
|
289
|
+
| 84
|
|
290
|
+
| 86
|
|
291
|
+
| 90
|
|
292
|
+
| 91
|
|
293
|
+
| 92
|
|
294
|
+
| 93
|
|
295
|
+
| 94
|
|
296
|
+
| 95
|
|
297
|
+
| 98
|
|
298
|
+
| 211
|
|
299
|
+
| 212
|
|
300
|
+
| 213
|
|
301
|
+
| 216
|
|
302
|
+
| 218
|
|
303
|
+
| 220
|
|
304
|
+
| 221
|
|
305
|
+
| 222
|
|
306
|
+
| 223
|
|
307
|
+
| 224
|
|
308
|
+
| 225
|
|
309
|
+
| 226
|
|
310
|
+
| 227
|
|
311
|
+
| 228
|
|
312
|
+
| 229
|
|
313
|
+
| 230
|
|
314
|
+
| 231
|
|
315
|
+
| 232
|
|
316
|
+
| 233
|
|
317
|
+
| 234
|
|
318
|
+
| 235
|
|
319
|
+
| 236
|
|
320
|
+
| 237
|
|
321
|
+
| 238
|
|
322
|
+
| 239
|
|
323
|
+
| 240
|
|
324
|
+
| 241
|
|
325
|
+
| 242
|
|
326
|
+
| 243
|
|
327
|
+
| 244
|
|
328
|
+
| 245
|
|
329
|
+
| 246
|
|
330
|
+
| 247
|
|
331
|
+
| 248
|
|
332
|
+
| 249
|
|
333
|
+
| 250
|
|
334
|
+
| 251
|
|
335
|
+
| 252
|
|
336
|
+
| 253
|
|
337
|
+
| 254
|
|
338
|
+
| 255
|
|
339
|
+
| 256
|
|
340
|
+
| 257
|
|
341
|
+
| 258
|
|
342
|
+
| 260
|
|
343
|
+
| 261
|
|
344
|
+
| 262
|
|
345
|
+
| 263
|
|
346
|
+
| 264
|
|
347
|
+
| 265
|
|
348
|
+
| 266
|
|
349
|
+
| 267
|
|
350
|
+
| 268
|
|
351
|
+
| 269
|
|
352
|
+
| 290
|
|
353
|
+
| 291
|
|
354
|
+
| 297
|
|
355
|
+
| 298
|
|
356
|
+
| 299
|
|
357
|
+
| 350
|
|
358
|
+
| 351
|
|
359
|
+
| 352
|
|
360
|
+
| 353
|
|
361
|
+
| 354
|
|
362
|
+
| 355
|
|
363
|
+
| 356
|
|
364
|
+
| 357
|
|
365
|
+
| 358
|
|
366
|
+
| 359
|
|
367
|
+
| 370
|
|
368
|
+
| 371
|
|
369
|
+
| 372
|
|
370
|
+
| 373
|
|
371
|
+
| 374
|
|
372
|
+
| 375
|
|
373
|
+
| 376
|
|
374
|
+
| 377
|
|
375
|
+
| 378
|
|
376
|
+
| 380
|
|
377
|
+
| 381
|
|
378
|
+
| 382
|
|
379
|
+
| 383
|
|
380
|
+
| 385
|
|
381
|
+
| 386
|
|
382
|
+
| 387
|
|
383
|
+
| 389
|
|
384
|
+
| 420
|
|
385
|
+
| 421
|
|
386
|
+
| 423
|
|
387
|
+
| 500
|
|
388
|
+
| 501
|
|
389
|
+
| 502
|
|
390
|
+
| 503
|
|
391
|
+
| 504
|
|
392
|
+
| 505
|
|
393
|
+
| 506
|
|
394
|
+
| 507
|
|
395
|
+
| 508
|
|
396
|
+
| 509
|
|
397
|
+
| 590
|
|
398
|
+
| 591
|
|
399
|
+
| 592
|
|
400
|
+
| 593
|
|
401
|
+
| 594
|
|
402
|
+
| 595
|
|
403
|
+
| 596
|
|
404
|
+
| 597
|
|
405
|
+
| 598
|
|
406
|
+
| 599
|
|
407
|
+
| 670
|
|
408
|
+
| 672
|
|
409
|
+
| 673
|
|
410
|
+
| 674
|
|
411
|
+
| 675
|
|
412
|
+
| 676
|
|
413
|
+
| 677
|
|
414
|
+
| 678
|
|
415
|
+
| 679
|
|
416
|
+
| 680
|
|
417
|
+
| 681
|
|
418
|
+
| 682
|
|
419
|
+
| 683
|
|
420
|
+
| 685
|
|
421
|
+
| 686
|
|
422
|
+
| 687
|
|
423
|
+
| 688
|
|
424
|
+
| 689
|
|
425
|
+
| 690
|
|
426
|
+
| 691
|
|
427
|
+
| 692
|
|
428
|
+
| 800
|
|
429
|
+
| 808
|
|
430
|
+
| 850
|
|
431
|
+
| 852
|
|
432
|
+
| 853
|
|
433
|
+
| 855
|
|
434
|
+
| 856
|
|
435
|
+
| 870
|
|
436
|
+
| 878
|
|
437
|
+
| 880
|
|
438
|
+
| 881
|
|
439
|
+
| 882
|
|
440
|
+
| 883
|
|
441
|
+
| 886
|
|
442
|
+
| 888
|
|
443
|
+
| 960
|
|
444
|
+
| 961
|
|
445
|
+
| 962
|
|
446
|
+
| 963
|
|
447
|
+
| 964
|
|
448
|
+
| 965
|
|
449
|
+
| 966
|
|
450
|
+
| 967
|
|
451
|
+
| 968
|
|
452
|
+
| 970
|
|
453
|
+
| 971
|
|
454
|
+
| 972
|
|
455
|
+
| 973
|
|
456
|
+
| 974
|
|
457
|
+
| 975
|
|
458
|
+
| 976
|
|
459
|
+
| 977
|
|
460
|
+
| 979
|
|
461
|
+
| 992
|
|
462
|
+
| 993
|
|
463
|
+
| 994
|
|
464
|
+
| 995
|
|
465
|
+
| 996
|
|
466
|
+
| 998;
|
|
467
|
+
|
|
468
|
+
export type CountryCallingCodeString = `${CountryCallingCodeNumeric}`;
|
|
469
|
+
|
|
470
|
+
export type CountryCodeToRegionCodeMap = Partial<Record<CountryCallingCodeString, Array<RegionCode>>>;
|
|
471
|
+
|
|
472
|
+
export interface Meta {
|
|
473
|
+
regionCodes: Array<RegionCode>;
|
|
474
|
+
countryCodeToRegionCodeMap: CountryCodeToRegionCodeMap;
|
|
475
|
+
countryToMetadata: Partial<Record<RegionCode, Array<any>>>;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Given array of region codes whose metadata is desired,
|
|
480
|
+
* Return libphonenumber metadata for those regions,
|
|
481
|
+
* including the necessary metadata for the main countries for each country calling code
|
|
482
|
+
*/
|
|
483
|
+
export function loadMeta(regionCodeArray?: Array<RegionCode>): Meta;
|
|
@@ -8489,7 +8489,7 @@
|
|
|
8489
8489
|
[
|
|
8490
8490
|
null,
|
|
8491
8491
|
null,
|
|
8492
|
-
"(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|
|
|
8492
|
+
"(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|90[25])[2-9]\\d{6}",
|
|
8493
8493
|
null,
|
|
8494
8494
|
null,
|
|
8495
8495
|
null,
|
|
@@ -8506,7 +8506,7 @@
|
|
|
8506
8506
|
[
|
|
8507
8507
|
null,
|
|
8508
8508
|
null,
|
|
8509
|
-
"(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|
|
|
8509
|
+
"(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|90[25])[2-9]\\d{6}",
|
|
8510
8510
|
null,
|
|
8511
8511
|
null,
|
|
8512
8512
|
null,
|
|
@@ -17965,7 +17965,7 @@
|
|
|
17965
17965
|
[
|
|
17966
17966
|
null,
|
|
17967
17967
|
null,
|
|
17968
|
-
"5(?:(?:(?:0555|1(?:[17]77|555))[5-9]|757(?:7[7-9]|8[01]))\\d|22252[0-4])\\d\\d|(?:5(?:
|
|
17968
|
+
"5(?:(?:(?:0555|1(?:[17]77|555))[5-9]|757(?:7[7-9]|8[01]))\\d|22252[0-4])\\d\\d|(?:5(?:0(?:0(?:0\\d|11|22|33|44|5[05]|77|88|9[09])|111)|1(?:1(?:00|[124]\\d|3[01])|4\\d\\d)|(?:44|68)\\d\\d|5(?:[0157-9]\\d\\d|200)|7(?:[0147-9]\\d\\d|5(?:00|[57]5))|8(?:0(?:[018]\\d|2[0-4])|58[89]|8(?:55|88))|9(?:090|[1-35-9]\\d\\d))|790\\d\\d)\\d{4}|5(?:0(?:0[17]0|505)|1(?:0[01]0|1(?:07|33|51))|2(?:0[02]0|2[25]2)|3(?:0[03]0|3[35]3)|(?:40[04]|900)0|5222)[0-4]\\d{3}",
|
|
17969
17969
|
null,
|
|
17970
17970
|
null,
|
|
17971
17971
|
null,
|
|
@@ -23000,7 +23000,7 @@
|
|
|
23000
23000
|
[
|
|
23001
23001
|
null,
|
|
23002
23002
|
null,
|
|
23003
|
-
"7(?:38(?:0\\d|5[
|
|
23003
|
+
"7(?:38(?:0\\d|5[019]|88)|8(?:33|55|77|81)\\d)\\d{4}|7(?:18|2[23]|3[237]|47|6[258]|7\\d|82|9[2-9])\\d{6}",
|
|
23004
23004
|
null,
|
|
23005
23005
|
null,
|
|
23006
23006
|
null,
|
|
@@ -30179,7 +30179,7 @@
|
|
|
30179
30179
|
"LT",
|
|
30180
30180
|
370,
|
|
30181
30181
|
"00",
|
|
30182
|
-
"
|
|
30182
|
+
"0",
|
|
30183
30183
|
null,
|
|
30184
30184
|
null,
|
|
30185
30185
|
"[08]",
|
|
@@ -30194,7 +30194,7 @@
|
|
|
30194
30194
|
[
|
|
30195
30195
|
"52[0-7]"
|
|
30196
30196
|
],
|
|
30197
|
-
"(
|
|
30197
|
+
"(0-$1)",
|
|
30198
30198
|
null,
|
|
30199
30199
|
1
|
|
30200
30200
|
],
|
|
@@ -30205,7 +30205,7 @@
|
|
|
30205
30205
|
[
|
|
30206
30206
|
"[7-9]"
|
|
30207
30207
|
],
|
|
30208
|
-
"
|
|
30208
|
+
"0 $1",
|
|
30209
30209
|
null,
|
|
30210
30210
|
1
|
|
30211
30211
|
],
|
|
@@ -30216,7 +30216,7 @@
|
|
|
30216
30216
|
[
|
|
30217
30217
|
"37|4(?:[15]|6[1-8])"
|
|
30218
30218
|
],
|
|
30219
|
-
"(
|
|
30219
|
+
"(0-$1)",
|
|
30220
30220
|
null,
|
|
30221
30221
|
1
|
|
30222
30222
|
],
|
|
@@ -30227,7 +30227,7 @@
|
|
|
30227
30227
|
[
|
|
30228
30228
|
"[3-6]"
|
|
30229
30229
|
],
|
|
30230
|
-
"(
|
|
30230
|
+
"(0-$1)",
|
|
30231
30231
|
null,
|
|
30232
30232
|
1
|
|
30233
30233
|
]
|
|
@@ -50053,7 +50053,7 @@
|
|
|
50053
50053
|
[
|
|
50054
50054
|
null,
|
|
50055
50055
|
null,
|
|
50056
|
-
"[1-6]\\d{
|
|
50056
|
+
"(?:[1-6]\\d|71)\\d{6}",
|
|
50057
50057
|
null,
|
|
50058
50058
|
null,
|
|
50059
50059
|
null,
|
|
@@ -50076,7 +50076,7 @@
|
|
|
50076
50076
|
[
|
|
50077
50077
|
null,
|
|
50078
50078
|
null,
|
|
50079
|
-
"6\\d{
|
|
50079
|
+
"(?:6\\d|71)\\d{6}",
|
|
50080
50080
|
null,
|
|
50081
50081
|
null,
|
|
50082
50082
|
null,
|
|
@@ -50186,7 +50186,7 @@
|
|
|
50186
50186
|
"(\\d{2})(\\d{6})",
|
|
50187
50187
|
"$1 $2",
|
|
50188
50188
|
[
|
|
50189
|
-
"
|
|
50189
|
+
"[67]"
|
|
50190
50190
|
],
|
|
50191
50191
|
"8 $1"
|
|
50192
50192
|
]
|
|
@@ -51682,7 +51682,7 @@
|
|
|
51682
51682
|
[
|
|
51683
51683
|
null,
|
|
51684
51684
|
null,
|
|
51685
|
-
"
|
|
51685
|
+
"(?:6[125-9]|7[13-9])\\d{7}",
|
|
51686
51686
|
null,
|
|
51687
51687
|
null,
|
|
51688
51688
|
null,
|
|
@@ -51894,7 +51894,7 @@
|
|
|
51894
51894
|
[
|
|
51895
51895
|
null,
|
|
51896
51896
|
null,
|
|
51897
|
-
"(?:39|50|6[36-8]|7[1-
|
|
51897
|
+
"(?:39|50|6[36-8]|7[1-357]|9[1-9])\\d{7}",
|
|
51898
51898
|
null,
|
|
51899
51899
|
null,
|
|
51900
51900
|
null,
|
|
@@ -52130,7 +52130,7 @@
|
|
|
52130
52130
|
[
|
|
52131
52131
|
null,
|
|
52132
52132
|
null,
|
|
52133
|
-
"72(?:[48]0|6[01])\\d{5}|7(?:[015-8]\\d|20|36|4[0-
|
|
52133
|
+
"72(?:[48]0|6[01])\\d{5}|7(?:[015-8]\\d|20|36|4[0-5]|9[89])\\d{6}",
|
|
52134
52134
|
null,
|
|
52135
52135
|
null,
|
|
52136
52136
|
null,
|
|
@@ -52332,7 +52332,7 @@
|
|
|
52332
52332
|
[
|
|
52333
52333
|
null,
|
|
52334
52334
|
null,
|
|
52335
|
-
"(?:5056(?:[0-35-9]\\d|4[468])|7302[0-3]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|983[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[
|
|
52335
|
+
"(?:5056(?:[0-35-9]\\d|4[468])|7302[0-3]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|983[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013569]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}",
|
|
52336
52336
|
null,
|
|
52337
52337
|
null,
|
|
52338
52338
|
null,
|
|
@@ -52347,7 +52347,7 @@
|
|
|
52347
52347
|
[
|
|
52348
52348
|
null,
|
|
52349
52349
|
null,
|
|
52350
|
-
"(?:5056(?:[0-35-9]\\d|4[468])|7302[0-3]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|983[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[
|
|
52350
|
+
"(?:5056(?:[0-35-9]\\d|4[468])|7302[0-3]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|983[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013569]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}",
|
|
52351
52351
|
null,
|
|
52352
52352
|
null,
|
|
52353
52353
|
null,
|