fullstack-phone 1.147.1 → 1.149.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 +30 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.149.0
|
|
4
|
+
|
|
5
|
+
* Added Typescript declaration files
|
|
6
|
+
|
|
7
|
+
## 1.148.0
|
|
8
|
+
|
|
9
|
+
* Metadata:
|
|
10
|
+
* Updated to libphonenumber v8.13.32
|
|
11
|
+
|
|
3
12
|
## 1.147.1
|
|
13
|
+
|
|
4
14
|
* Bugfix:
|
|
5
|
-
*
|
|
15
|
+
* Restored `client/index.js` to ES5 (was generated with ESNEXT in v1.142.0)
|
|
6
16
|
|
|
7
17
|
## 1.147.0
|
|
8
18
|
|
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.32](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
CHANGED
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
export type RegionCode =
|
|
2
|
+
| 'AC'
|
|
3
|
+
| 'AD'
|
|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|
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;
|
|
@@ -10852,6 +10852,16 @@
|
|
|
10852
10852
|
"00",
|
|
10853
10853
|
null,
|
|
10854
10854
|
[
|
|
10855
|
+
[
|
|
10856
|
+
null,
|
|
10857
|
+
"(\\d{5,6})",
|
|
10858
|
+
"$1",
|
|
10859
|
+
[
|
|
10860
|
+
"1(?:00|2[13])|95",
|
|
10861
|
+
"1(?:00|2(?:11|39))|95",
|
|
10862
|
+
"1(?:00|2(?:110|395))|95"
|
|
10863
|
+
]
|
|
10864
|
+
],
|
|
10855
10865
|
[
|
|
10856
10866
|
null,
|
|
10857
10867
|
"(\\d{5,6})",
|
|
@@ -17460,7 +17470,7 @@
|
|
|
17460
17470
|
[
|
|
17461
17471
|
null,
|
|
17462
17472
|
null,
|
|
17463
|
-
"(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:[0-5]\\d\\d|69[7-9]
|
|
17473
|
+
"(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-2]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",
|
|
17464
17474
|
null,
|
|
17465
17475
|
null,
|
|
17466
17476
|
null,
|
|
@@ -31225,7 +31235,7 @@
|
|
|
31225
31235
|
[
|
|
31226
31236
|
null,
|
|
31227
31237
|
null,
|
|
31228
|
-
"4(?:[
|
|
31238
|
+
"4(?:[469]\\d|5[1-9])\\d{5}|(?:3|6\\d)\\d{7}",
|
|
31229
31239
|
null,
|
|
31230
31240
|
null,
|
|
31231
31241
|
null,
|
|
@@ -52322,7 +52332,7 @@
|
|
|
52322
52332
|
[
|
|
52323
52333
|
null,
|
|
52324
52334
|
null,
|
|
52325
|
-
"(?:5056(?:[0-35-9]\\d|4[468])|7302[0-3]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|983[
|
|
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[149]|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}",
|
|
52326
52336
|
null,
|
|
52327
52337
|
null,
|
|
52328
52338
|
null,
|
|
@@ -52337,7 +52347,7 @@
|
|
|
52337
52347
|
[
|
|
52338
52348
|
null,
|
|
52339
52349
|
null,
|
|
52340
|
-
"(?:5056(?:[0-35-9]\\d|4[468])|7302[0-3]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|983[
|
|
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[149]|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}",
|
|
52341
52351
|
null,
|
|
52342
52352
|
null,
|
|
52343
52353
|
null,
|
|
@@ -54999,7 +55009,7 @@
|
|
|
54999
55009
|
[
|
|
55000
55010
|
null,
|
|
55001
55011
|
null,
|
|
55002
|
-
"
|
|
55012
|
+
"2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}",
|
|
55003
55013
|
null,
|
|
55004
55014
|
null,
|
|
55005
55015
|
null,
|
|
@@ -55008,13 +55018,16 @@
|
|
|
55008
55018
|
null,
|
|
55009
55019
|
[
|
|
55010
55020
|
8,
|
|
55011
|
-
9
|
|
55021
|
+
9,
|
|
55022
|
+
10,
|
|
55023
|
+
11,
|
|
55024
|
+
12
|
|
55012
55025
|
]
|
|
55013
55026
|
],
|
|
55014
55027
|
[
|
|
55015
55028
|
null,
|
|
55016
55029
|
null,
|
|
55017
|
-
"(?:2[89]|39)0\\d{6}|[
|
|
55030
|
+
"38\\d{6,10}|(?:2[89]|39)(?:0\\d{5,6}|[1-9]\\d{5})",
|
|
55018
55031
|
null,
|
|
55019
55032
|
null,
|
|
55020
55033
|
null,
|
|
@@ -55138,7 +55151,16 @@
|
|
|
55138
55151
|
"(\\d{3})(\\d{3})(\\d{3})",
|
|
55139
55152
|
"$1 $2 $3",
|
|
55140
55153
|
[
|
|
55141
|
-
"
|
|
55154
|
+
"2|39"
|
|
55155
|
+
],
|
|
55156
|
+
"0$1"
|
|
55157
|
+
],
|
|
55158
|
+
[
|
|
55159
|
+
null,
|
|
55160
|
+
"(\\d{2})(\\d{7,10})",
|
|
55161
|
+
"$1 $2",
|
|
55162
|
+
[
|
|
55163
|
+
"3"
|
|
55142
55164
|
],
|
|
55143
55165
|
"0$1"
|
|
55144
55166
|
]
|