global-phone-validator 1.2.1 → 1.3.2
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/README.md +143 -78
- package/dist/countryData.d.ts +24 -0
- package/dist/countryData.d.ts.map +1 -0
- package/dist/countryData.js +1015 -0
- package/dist/countryData.js.map +1 -0
- package/dist/dataAccess.d.ts +35 -0
- package/dist/dataAccess.d.ts.map +1 -0
- package/dist/dataAccess.js +92 -0
- package/dist/dataAccess.js.map +1 -0
- package/dist/index.d.ts +0 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -95
- package/dist/index.js.map +1 -1
- package/dist/mobilePrefixes.d.ts +3 -10
- package/dist/mobilePrefixes.d.ts.map +1 -1
- package/dist/mobilePrefixes.js +372 -143
- package/dist/mobilePrefixes.js.map +1 -1
- package/dist/phoneTypes.d.ts +10 -0
- package/dist/phoneTypes.d.ts.map +1 -0
- package/dist/phoneTypes.js +63 -0
- package/dist/phoneTypes.js.map +1 -0
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -1
- package/dist/utils.d.ts +0 -17
- package/dist/utils.js +12 -20
- package/package.json +2 -2
package/dist/mobilePrefixes.js
CHANGED
|
@@ -1,229 +1,458 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Mobile number prefix rules for countries
|
|
4
|
-
* Format: { countryCode: { mobilePrefixes: string[], landlinePrefixes?: string[] } }
|
|
5
|
-
*/
|
|
6
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
3
|
exports.MOBILE_PREFIX_RULES = void 0;
|
|
8
4
|
exports.isMobileNumber = isMobileNumber;
|
|
9
|
-
exports.isLandlineNumber = isLandlineNumber;
|
|
10
5
|
exports.MOBILE_PREFIX_RULES = {
|
|
11
|
-
// India (91)
|
|
12
6
|
"91": {
|
|
13
7
|
mobilePrefixes: ["6", "7", "8", "9"],
|
|
14
|
-
landlinePrefixes: ["0", "1", "2", "3", "4", "5"],
|
|
15
8
|
},
|
|
16
|
-
// Germany (49)
|
|
17
9
|
"49": {
|
|
18
|
-
mobilePrefixes: [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
mobilePrefixes: [
|
|
11
|
+
"151",
|
|
12
|
+
"152",
|
|
13
|
+
"153",
|
|
14
|
+
"154",
|
|
15
|
+
"155",
|
|
16
|
+
"156",
|
|
17
|
+
"157",
|
|
18
|
+
"158",
|
|
19
|
+
"159",
|
|
20
|
+
"160",
|
|
21
|
+
"162",
|
|
22
|
+
"163",
|
|
23
|
+
"170",
|
|
24
|
+
"171",
|
|
25
|
+
"172",
|
|
26
|
+
"173",
|
|
27
|
+
"174",
|
|
28
|
+
"175",
|
|
29
|
+
"176",
|
|
30
|
+
"177",
|
|
31
|
+
"178",
|
|
32
|
+
"179",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
// United States/Canada (1) - No specific mobile prefix (all numbers can be mobile)
|
|
22
36
|
"1": {
|
|
23
37
|
mobilePrefixes: [], // All 10-digit numbers can be mobile or landline
|
|
24
|
-
landlinePrefixes: [],
|
|
25
38
|
},
|
|
26
|
-
// United Kingdom (44)
|
|
39
|
+
// United Kingdom (44) - Mobile: 7
|
|
27
40
|
"44": {
|
|
28
|
-
mobilePrefixes: ["7"],
|
|
29
|
-
landlinePrefixes: ["1", "2", "3", "4", "5", "6", "8", "9"],
|
|
41
|
+
mobilePrefixes: ["7"],
|
|
30
42
|
},
|
|
31
|
-
// France (33)
|
|
43
|
+
// France (33) - Mobile: 6, 7
|
|
32
44
|
"33": {
|
|
33
|
-
mobilePrefixes: ["6", "7"],
|
|
34
|
-
landlinePrefixes: ["1", "2", "3", "4", "5", "8", "9"],
|
|
45
|
+
mobilePrefixes: ["6", "7"],
|
|
35
46
|
},
|
|
36
|
-
// Italy (39)
|
|
47
|
+
// Italy (39) - Mobile: 3
|
|
37
48
|
"39": {
|
|
38
|
-
mobilePrefixes: ["3"],
|
|
39
|
-
landlinePrefixes: ["0", "1", "2", "4", "5", "6", "7", "8", "9"],
|
|
49
|
+
mobilePrefixes: ["3"],
|
|
40
50
|
},
|
|
41
|
-
// Spain (34)
|
|
51
|
+
// Spain (34) - Mobile: 6, 7
|
|
42
52
|
"34": {
|
|
43
|
-
mobilePrefixes: ["6", "7"],
|
|
44
|
-
landlinePrefixes: ["8", "9"],
|
|
53
|
+
mobilePrefixes: ["6", "7"],
|
|
45
54
|
},
|
|
46
|
-
// Australia (61)
|
|
55
|
+
// Australia (61) - Mobile: 4
|
|
47
56
|
"61": {
|
|
48
|
-
mobilePrefixes: ["4"],
|
|
49
|
-
landlinePrefixes: ["2", "3", "7", "8"],
|
|
57
|
+
mobilePrefixes: ["4"],
|
|
50
58
|
},
|
|
51
|
-
// Brazil (55)
|
|
59
|
+
// Brazil (55) - Mobile: 9 (after area code, but we check the full number)
|
|
52
60
|
"55": {
|
|
53
|
-
mobilePrefixes: ["9"], // Mobile numbers
|
|
54
|
-
landlinePrefixes: ["1", "2", "3", "4", "5", "6", "7", "8"],
|
|
61
|
+
mobilePrefixes: ["9"], // Mobile numbers typically have 9 as second digit after area code
|
|
55
62
|
},
|
|
56
|
-
// China (86)
|
|
63
|
+
// China (86) - Mobile: 13x, 14x, 15x, 16x, 17x, 18x, 19x
|
|
57
64
|
"86": {
|
|
58
|
-
mobilePrefixes: ["13", "14", "15", "16", "17", "18", "19"],
|
|
59
|
-
landlinePrefixes: ["10", "20", "21", "22", "23", "24", "25", "27", "28", "29", "311", "351", "371", "431", "451", "471", "531", "551", "571", "591", "631", "671", "731", "751", "771", "791", "851", "871", "891", "898", "931", "951", "971", "991"],
|
|
65
|
+
mobilePrefixes: ["13", "14", "15", "16", "17", "18", "19"],
|
|
60
66
|
},
|
|
61
|
-
// Japan (81)
|
|
67
|
+
// Japan (81) - Mobile: 70, 80, 90
|
|
62
68
|
"81": {
|
|
63
|
-
mobilePrefixes: ["70", "80", "90"],
|
|
64
|
-
landlinePrefixes: ["3", "6", "11", "52", "92", "93", "95", "96", "98"],
|
|
69
|
+
mobilePrefixes: ["70", "80", "90"],
|
|
65
70
|
},
|
|
66
|
-
// South Korea (82)
|
|
71
|
+
// South Korea (82) - Mobile: 10, 11, 16, 17, 18, 19
|
|
67
72
|
"82": {
|
|
68
|
-
mobilePrefixes: ["10", "11", "16", "17", "18", "19"],
|
|
69
|
-
landlinePrefixes: ["2", "31", "32", "33", "41", "42", "43", "44", "51", "52", "53", "54", "55", "61", "62", "63", "64"],
|
|
73
|
+
mobilePrefixes: ["10", "11", "16", "17", "18", "19"],
|
|
70
74
|
},
|
|
71
|
-
// Russia (7)
|
|
75
|
+
// Russia (7) - Mobile: 9
|
|
72
76
|
"7": {
|
|
73
|
-
mobilePrefixes: ["9"],
|
|
74
|
-
landlinePrefixes: ["3", "4", "5", "8"],
|
|
77
|
+
mobilePrefixes: ["9"],
|
|
75
78
|
},
|
|
76
|
-
// Netherlands (31)
|
|
79
|
+
// Netherlands (31) - Mobile: 6
|
|
77
80
|
"31": {
|
|
78
|
-
mobilePrefixes: ["6"],
|
|
79
|
-
landlinePrefixes: ["1", "2", "3", "4", "5", "7", "8", "9"],
|
|
81
|
+
mobilePrefixes: ["6"],
|
|
80
82
|
},
|
|
81
|
-
// Sweden (46)
|
|
83
|
+
// Sweden (46) - Mobile: 7
|
|
82
84
|
"46": {
|
|
83
|
-
mobilePrefixes: ["7"],
|
|
84
|
-
landlinePrefixes: ["8", "11", "13", "16", "18", "19", "21", "23", "26", "31", "33", "35", "36", "40", "42", "44", "46", "54", "60", "63", "90"],
|
|
85
|
+
mobilePrefixes: ["7"],
|
|
85
86
|
},
|
|
86
|
-
// Norway (47)
|
|
87
|
+
// Norway (47) - Mobile: 4, 9
|
|
87
88
|
"47": {
|
|
88
|
-
mobilePrefixes: ["4", "9"],
|
|
89
|
-
landlinePrefixes: ["2", "3", "5", "6", "7", "8"],
|
|
89
|
+
mobilePrefixes: ["4", "9"],
|
|
90
90
|
},
|
|
91
|
-
// Poland (48)
|
|
91
|
+
// Poland (48) - Mobile: 5, 6, 7, 8, 9
|
|
92
92
|
"48": {
|
|
93
|
-
mobilePrefixes: ["5", "6", "7", "8", "9"],
|
|
94
|
-
landlinePrefixes: ["1", "2", "3", "4"],
|
|
93
|
+
mobilePrefixes: ["5", "6", "7", "8", "9"],
|
|
95
94
|
},
|
|
96
|
-
// Turkey (90)
|
|
95
|
+
// Turkey (90) - Mobile: 5
|
|
97
96
|
"90": {
|
|
98
|
-
mobilePrefixes: ["5"],
|
|
99
|
-
landlinePrefixes: ["2", "3", "4"],
|
|
97
|
+
mobilePrefixes: ["5"],
|
|
100
98
|
},
|
|
101
|
-
// Pakistan (92)
|
|
99
|
+
// Pakistan (92) - Mobile: 3
|
|
102
100
|
"92": {
|
|
103
|
-
mobilePrefixes: ["3"],
|
|
104
|
-
landlinePrefixes: ["4", "5", "6", "7", "8", "9"],
|
|
101
|
+
mobilePrefixes: ["3"],
|
|
105
102
|
},
|
|
106
|
-
// Indonesia (62)
|
|
103
|
+
// Indonesia (62) - Mobile: 8
|
|
107
104
|
"62": {
|
|
108
|
-
mobilePrefixes: ["8"],
|
|
109
|
-
landlinePrefixes: ["2", "3", "4", "5", "6", "7", "9"],
|
|
105
|
+
mobilePrefixes: ["8"],
|
|
110
106
|
},
|
|
111
|
-
// Philippines (63)
|
|
107
|
+
// Philippines (63) - Mobile: 9
|
|
112
108
|
"63": {
|
|
113
|
-
mobilePrefixes: ["9"],
|
|
114
|
-
landlinePrefixes: ["2", "3", "4", "5", "6", "7", "8"],
|
|
109
|
+
mobilePrefixes: ["9"],
|
|
115
110
|
},
|
|
116
|
-
// Thailand (66)
|
|
111
|
+
// Thailand (66) - Mobile: 6, 8, 9
|
|
117
112
|
"66": {
|
|
118
|
-
mobilePrefixes: ["6", "8", "9"],
|
|
119
|
-
landlinePrefixes: ["2", "3", "4", "5", "7"],
|
|
113
|
+
mobilePrefixes: ["6", "8", "9"],
|
|
120
114
|
},
|
|
121
|
-
// Malaysia (60)
|
|
115
|
+
// Malaysia (60) - Mobile: 1
|
|
122
116
|
"60": {
|
|
123
|
-
mobilePrefixes: ["1"],
|
|
124
|
-
landlinePrefixes: ["3", "4", "5", "6", "7", "9"],
|
|
117
|
+
mobilePrefixes: ["1"],
|
|
125
118
|
},
|
|
126
|
-
// Singapore (65)
|
|
119
|
+
// Singapore (65) - Mobile: 8, 9
|
|
127
120
|
"65": {
|
|
128
|
-
mobilePrefixes: ["8", "9"],
|
|
129
|
-
landlinePrefixes: ["6"],
|
|
121
|
+
mobilePrefixes: ["8", "9"],
|
|
130
122
|
},
|
|
131
|
-
// New Zealand (64)
|
|
123
|
+
// New Zealand (64) - Mobile: 2
|
|
132
124
|
"64": {
|
|
133
|
-
mobilePrefixes: ["2"],
|
|
134
|
-
landlinePrefixes: ["3", "4", "6", "7", "9"],
|
|
125
|
+
mobilePrefixes: ["2"],
|
|
135
126
|
},
|
|
136
|
-
// Vietnam (84)
|
|
127
|
+
// Vietnam (84) - Mobile: 9
|
|
137
128
|
"84": {
|
|
138
|
-
mobilePrefixes: ["9"],
|
|
139
|
-
landlinePrefixes: ["2", "3", "4", "5", "6", "7", "8"],
|
|
129
|
+
mobilePrefixes: ["9"],
|
|
140
130
|
},
|
|
141
|
-
// UAE (971)
|
|
131
|
+
// UAE (971) - Mobile: 5
|
|
142
132
|
"971": {
|
|
143
|
-
mobilePrefixes: ["5"],
|
|
144
|
-
landlinePrefixes: ["2", "3", "4", "6", "7", "9"],
|
|
133
|
+
mobilePrefixes: ["5"],
|
|
145
134
|
},
|
|
146
|
-
// South Africa (27)
|
|
135
|
+
// South Africa (27) - Mobile: 6, 7, 8
|
|
147
136
|
"27": {
|
|
148
|
-
mobilePrefixes: ["6", "7", "8"],
|
|
149
|
-
landlinePrefixes: ["1", "2", "3", "4", "5", "9"],
|
|
137
|
+
mobilePrefixes: ["6", "7", "8"],
|
|
150
138
|
},
|
|
151
|
-
// Nigeria (234)
|
|
139
|
+
// Nigeria (234) - Mobile: 7, 8, 9
|
|
152
140
|
"234": {
|
|
153
|
-
mobilePrefixes: ["7", "8", "9"],
|
|
154
|
-
landlinePrefixes: ["1", "2", "3", "4", "5", "6"],
|
|
141
|
+
mobilePrefixes: ["7", "8", "9"],
|
|
155
142
|
},
|
|
156
|
-
// Mexico (52)
|
|
143
|
+
// Mexico (52) - Mobile: 1 (after area code)
|
|
157
144
|
"52": {
|
|
158
|
-
mobilePrefixes: ["1"],
|
|
159
|
-
landlinePrefixes: ["2", "3", "4", "5", "6", "7", "8", "9"],
|
|
145
|
+
mobilePrefixes: ["1"],
|
|
160
146
|
},
|
|
161
|
-
// Argentina (54)
|
|
147
|
+
// Argentina (54) - Mobile: 9
|
|
162
148
|
"54": {
|
|
163
|
-
mobilePrefixes: ["9"],
|
|
164
|
-
landlinePrefixes: ["1", "2", "3", "4", "5", "6", "7", "8"],
|
|
149
|
+
mobilePrefixes: ["9"],
|
|
165
150
|
},
|
|
166
|
-
// Colombia (57)
|
|
151
|
+
// Colombia (57) - Mobile: 3
|
|
167
152
|
"57": {
|
|
168
|
-
mobilePrefixes: ["3"],
|
|
169
|
-
|
|
153
|
+
mobilePrefixes: ["3"],
|
|
154
|
+
},
|
|
155
|
+
// Chile (56) - Mobile: 9
|
|
156
|
+
"56": {
|
|
157
|
+
mobilePrefixes: ["9"],
|
|
158
|
+
},
|
|
159
|
+
// Peru (51) - Mobile: 9
|
|
160
|
+
"51": {
|
|
161
|
+
mobilePrefixes: ["9"],
|
|
162
|
+
},
|
|
163
|
+
// Venezuela (58) - Mobile: 4
|
|
164
|
+
"58": {
|
|
165
|
+
mobilePrefixes: ["4"],
|
|
166
|
+
},
|
|
167
|
+
// Bangladesh (880) - Mobile: 13, 14, 15, 16, 17, 18, 19
|
|
168
|
+
"880": {
|
|
169
|
+
mobilePrefixes: ["13", "14", "15", "16", "17", "18", "19"],
|
|
170
|
+
},
|
|
171
|
+
// Sri Lanka (94) - Mobile: 7
|
|
172
|
+
"94": {
|
|
173
|
+
mobilePrefixes: ["7"],
|
|
174
|
+
},
|
|
175
|
+
// Myanmar (95) - Mobile: 9
|
|
176
|
+
"95": {
|
|
177
|
+
mobilePrefixes: ["9"],
|
|
178
|
+
},
|
|
179
|
+
// Iran (98) - Mobile: 9
|
|
180
|
+
"98": {
|
|
181
|
+
mobilePrefixes: ["9"],
|
|
182
|
+
},
|
|
183
|
+
// Israel (972) - Mobile: 5
|
|
184
|
+
"972": {
|
|
185
|
+
mobilePrefixes: ["5"],
|
|
186
|
+
},
|
|
187
|
+
// Hong Kong (852) - Mobile: 5, 6, 9
|
|
188
|
+
"852": {
|
|
189
|
+
mobilePrefixes: ["5", "6", "9"],
|
|
190
|
+
},
|
|
191
|
+
// Taiwan (886) - Mobile: 9
|
|
192
|
+
"886": {
|
|
193
|
+
mobilePrefixes: ["9"],
|
|
194
|
+
},
|
|
195
|
+
// Afghanistan (93) - Mobile: 70, 71, 72, 73, 74, 75, 76, 77, 78, 79
|
|
196
|
+
"93": {
|
|
197
|
+
mobilePrefixes: [
|
|
198
|
+
"70",
|
|
199
|
+
"71",
|
|
200
|
+
"72",
|
|
201
|
+
"73",
|
|
202
|
+
"74",
|
|
203
|
+
"75",
|
|
204
|
+
"76",
|
|
205
|
+
"77",
|
|
206
|
+
"78",
|
|
207
|
+
"79",
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
// Albania (355) - Mobile: 66, 67, 68, 69
|
|
211
|
+
"355": {
|
|
212
|
+
mobilePrefixes: ["66", "67", "68", "69"],
|
|
213
|
+
},
|
|
214
|
+
// Algeria (213) - Mobile: 5, 6, 7
|
|
215
|
+
"213": {
|
|
216
|
+
mobilePrefixes: ["5", "6", "7"],
|
|
217
|
+
},
|
|
218
|
+
// Angola (244) - Mobile: 91, 92, 93, 94, 95, 96, 97, 98, 99
|
|
219
|
+
"244": {
|
|
220
|
+
mobilePrefixes: ["91", "92", "93", "94", "95", "96", "97", "98", "99"],
|
|
221
|
+
},
|
|
222
|
+
// Austria (43) - Mobile: 6
|
|
223
|
+
"43": {
|
|
224
|
+
mobilePrefixes: ["6"],
|
|
225
|
+
},
|
|
226
|
+
// Azerbaijan (994) - Mobile: 50, 51, 55, 70, 77
|
|
227
|
+
"994": {
|
|
228
|
+
mobilePrefixes: ["50", "51", "55", "70", "77"],
|
|
229
|
+
},
|
|
230
|
+
// Bahrain (973) - Mobile: 3, 6, 9
|
|
231
|
+
"973": {
|
|
232
|
+
mobilePrefixes: ["3", "6", "9"],
|
|
233
|
+
},
|
|
234
|
+
// Belarus (375) - Mobile: 25, 29, 33, 44
|
|
235
|
+
"375": {
|
|
236
|
+
mobilePrefixes: ["25", "29", "33", "44"],
|
|
237
|
+
},
|
|
238
|
+
// Belgium (32) - Mobile: 4
|
|
239
|
+
"32": {
|
|
240
|
+
mobilePrefixes: ["4"],
|
|
241
|
+
},
|
|
242
|
+
// Bolivia (591) - Mobile: 6, 7
|
|
243
|
+
"591": {
|
|
244
|
+
mobilePrefixes: ["6", "7"],
|
|
245
|
+
},
|
|
246
|
+
// Bosnia and Herzegovina (387) - Mobile: 60, 61, 62, 63, 64, 65, 66
|
|
247
|
+
"387": {
|
|
248
|
+
mobilePrefixes: ["60", "61", "62", "63", "64", "65", "66"],
|
|
249
|
+
},
|
|
250
|
+
// Botswana (267) - Mobile: 7
|
|
251
|
+
"267": {
|
|
252
|
+
mobilePrefixes: ["7"],
|
|
253
|
+
},
|
|
254
|
+
// Bulgaria (359) - Mobile: 87, 88, 89, 98
|
|
255
|
+
"359": {
|
|
256
|
+
mobilePrefixes: ["87", "88", "89", "98"],
|
|
257
|
+
},
|
|
258
|
+
// Cambodia (855) - Mobile: 1, 6, 7, 8, 9
|
|
259
|
+
"855": {
|
|
260
|
+
mobilePrefixes: ["1", "6", "7", "8", "9"],
|
|
261
|
+
},
|
|
262
|
+
// Cameroon (237) - Mobile: 6
|
|
263
|
+
"237": {
|
|
264
|
+
mobilePrefixes: ["6"],
|
|
265
|
+
},
|
|
266
|
+
// Croatia (385) - Mobile: 9
|
|
267
|
+
"385": {
|
|
268
|
+
mobilePrefixes: ["9"],
|
|
269
|
+
},
|
|
270
|
+
// Cuba (53) - Mobile: 5
|
|
271
|
+
"53": {
|
|
272
|
+
mobilePrefixes: ["5"],
|
|
273
|
+
},
|
|
274
|
+
// Cyprus (357) - Mobile: 9
|
|
275
|
+
"357": {
|
|
276
|
+
mobilePrefixes: ["9"],
|
|
277
|
+
},
|
|
278
|
+
// Czech Republic (420) - Mobile: 6, 7
|
|
279
|
+
"420": {
|
|
280
|
+
mobilePrefixes: ["6", "7"],
|
|
281
|
+
},
|
|
282
|
+
// Denmark (45) - Mobile: 2, 3, 4, 5, 6, 7, 8, 9
|
|
283
|
+
"45": {
|
|
284
|
+
mobilePrefixes: ["2", "3", "4", "5", "6", "7", "8", "9"],
|
|
285
|
+
},
|
|
286
|
+
// Egypt (20) - Mobile: 10, 11, 12, 15
|
|
287
|
+
"20": {
|
|
288
|
+
mobilePrefixes: ["10", "11", "12", "15"],
|
|
289
|
+
},
|
|
290
|
+
// Estonia (372) - Mobile: 5
|
|
291
|
+
"372": {
|
|
292
|
+
mobilePrefixes: ["5"],
|
|
293
|
+
},
|
|
294
|
+
// Ethiopia (251) - Mobile: 9
|
|
295
|
+
"251": {
|
|
296
|
+
mobilePrefixes: ["9"],
|
|
297
|
+
},
|
|
298
|
+
// Finland (358) - Mobile: 4, 5
|
|
299
|
+
"358": {
|
|
300
|
+
mobilePrefixes: ["4", "5"],
|
|
301
|
+
},
|
|
302
|
+
// Ghana (233) - Mobile: 2, 5
|
|
303
|
+
"233": {
|
|
304
|
+
mobilePrefixes: ["2", "5"],
|
|
305
|
+
},
|
|
306
|
+
// Greece (30) - Mobile: 6
|
|
307
|
+
"30": {
|
|
308
|
+
mobilePrefixes: ["6"],
|
|
309
|
+
},
|
|
310
|
+
// Hungary (36) - Mobile: 20, 30, 31, 50, 70
|
|
311
|
+
"36": {
|
|
312
|
+
mobilePrefixes: ["20", "30", "31", "50", "70"],
|
|
313
|
+
},
|
|
314
|
+
// Iceland (354) - Mobile: 6, 7, 8
|
|
315
|
+
"354": {
|
|
316
|
+
mobilePrefixes: ["6", "7", "8"],
|
|
317
|
+
},
|
|
318
|
+
// Iraq (964) - Mobile: 7
|
|
319
|
+
"964": {
|
|
320
|
+
mobilePrefixes: ["7"],
|
|
321
|
+
},
|
|
322
|
+
// Ireland (353) - Mobile: 8
|
|
323
|
+
"353": {
|
|
324
|
+
mobilePrefixes: ["8"],
|
|
325
|
+
},
|
|
326
|
+
// Jordan (962) - Mobile: 7
|
|
327
|
+
"962": {
|
|
328
|
+
mobilePrefixes: ["7"],
|
|
329
|
+
},
|
|
330
|
+
// Kazakhstan (7) - Same as Russia, Mobile: 7 (for Kazakhstan region)
|
|
331
|
+
// Note: Kazakhstan shares +7 with Russia, but uses 7xx prefixes
|
|
332
|
+
// Kenya (254) - Mobile: 7
|
|
333
|
+
"254": {
|
|
334
|
+
mobilePrefixes: ["7"],
|
|
335
|
+
},
|
|
336
|
+
// Kuwait (965) - Mobile: 5, 6, 9
|
|
337
|
+
"965": {
|
|
338
|
+
mobilePrefixes: ["5", "6", "9"],
|
|
339
|
+
},
|
|
340
|
+
// Lebanon (961) - Mobile: 3, 7
|
|
341
|
+
"961": {
|
|
342
|
+
mobilePrefixes: ["3", "7"],
|
|
343
|
+
},
|
|
344
|
+
// Luxembourg (352) - Mobile: 6
|
|
345
|
+
"352": {
|
|
346
|
+
mobilePrefixes: ["6"],
|
|
347
|
+
},
|
|
348
|
+
// Morocco (212) - Mobile: 6, 7
|
|
349
|
+
"212": {
|
|
350
|
+
mobilePrefixes: ["6", "7"],
|
|
351
|
+
},
|
|
352
|
+
// Nepal (977) - Mobile: 98, 99
|
|
353
|
+
"977": {
|
|
354
|
+
mobilePrefixes: ["98", "99"],
|
|
355
|
+
},
|
|
356
|
+
// Portugal (351) - Mobile: 9
|
|
357
|
+
"351": {
|
|
358
|
+
mobilePrefixes: ["9"],
|
|
359
|
+
},
|
|
360
|
+
// Qatar (974) - Mobile: 3, 5, 6, 7
|
|
361
|
+
"974": {
|
|
362
|
+
mobilePrefixes: ["3", "5", "6", "7"],
|
|
363
|
+
},
|
|
364
|
+
// Romania (40) - Mobile: 7
|
|
365
|
+
"40": {
|
|
366
|
+
mobilePrefixes: ["7"],
|
|
367
|
+
},
|
|
368
|
+
// Saudi Arabia (966) - Mobile: 5
|
|
369
|
+
"966": {
|
|
370
|
+
mobilePrefixes: ["5"],
|
|
371
|
+
},
|
|
372
|
+
// Serbia (381) - Mobile: 6
|
|
373
|
+
"381": {
|
|
374
|
+
mobilePrefixes: ["6"],
|
|
375
|
+
},
|
|
376
|
+
// Slovakia (421) - Mobile: 9
|
|
377
|
+
"421": {
|
|
378
|
+
mobilePrefixes: ["9"],
|
|
379
|
+
},
|
|
380
|
+
// Slovenia (386) - Mobile: 3, 4, 5, 6, 7, 8, 9
|
|
381
|
+
"386": {
|
|
382
|
+
mobilePrefixes: ["3", "4", "5", "6", "7", "8", "9"],
|
|
383
|
+
},
|
|
384
|
+
// Switzerland (41) - Mobile: 7, 8
|
|
385
|
+
"41": {
|
|
386
|
+
mobilePrefixes: ["7", "8"],
|
|
387
|
+
},
|
|
388
|
+
// Tunisia (216) - Mobile: 2, 9
|
|
389
|
+
"216": {
|
|
390
|
+
mobilePrefixes: ["2", "9"],
|
|
391
|
+
},
|
|
392
|
+
// Ukraine (380) - Mobile: 39, 50, 63, 66, 67, 68, 73, 93, 95, 96, 97, 98, 99
|
|
393
|
+
"380": {
|
|
394
|
+
mobilePrefixes: [
|
|
395
|
+
"39",
|
|
396
|
+
"50",
|
|
397
|
+
"63",
|
|
398
|
+
"66",
|
|
399
|
+
"67",
|
|
400
|
+
"68",
|
|
401
|
+
"73",
|
|
402
|
+
"93",
|
|
403
|
+
"95",
|
|
404
|
+
"96",
|
|
405
|
+
"97",
|
|
406
|
+
"98",
|
|
407
|
+
"99",
|
|
408
|
+
],
|
|
409
|
+
},
|
|
410
|
+
// Uruguay (598) - Mobile: 9
|
|
411
|
+
"598": {
|
|
412
|
+
mobilePrefixes: ["9"],
|
|
413
|
+
},
|
|
414
|
+
// Zimbabwe (263) - Mobile: 7
|
|
415
|
+
"263": {
|
|
416
|
+
mobilePrefixes: ["7"],
|
|
170
417
|
},
|
|
171
418
|
};
|
|
172
419
|
/**
|
|
173
420
|
* Check if a number is a mobile number based on country-specific prefix rules
|
|
421
|
+
*
|
|
422
|
+
* @deprecated Use detectPhoneNumberType from phoneTypes.ts instead
|
|
423
|
+
* This function is kept for backward compatibility
|
|
174
424
|
*/
|
|
175
425
|
function isMobileNumber(countryCode, nationalNumber) {
|
|
176
426
|
const rules = exports.MOBILE_PREFIX_RULES[countryCode];
|
|
177
427
|
if (!rules || rules.mobilePrefixes.length === 0) {
|
|
428
|
+
// Try to get from phoneTypes as fallback (unified data source)
|
|
429
|
+
try {
|
|
430
|
+
const { PHONE_TYPE_RULES } = require("./phoneTypes");
|
|
431
|
+
const phoneTypeRules = PHONE_TYPE_RULES[countryCode];
|
|
432
|
+
if (phoneTypeRules?.mobilePrefixes &&
|
|
433
|
+
phoneTypeRules.mobilePrefixes.length > 0) {
|
|
434
|
+
const sortedPrefixes = [...phoneTypeRules.mobilePrefixes].sort((a, b) => b.length - a.length);
|
|
435
|
+
for (const prefix of sortedPrefixes) {
|
|
436
|
+
if (nationalNumber.startsWith(prefix)) {
|
|
437
|
+
return true;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
catch (e) {
|
|
443
|
+
// Fallback failed, continue with undefined
|
|
444
|
+
}
|
|
178
445
|
return undefined; // No rules available
|
|
179
446
|
}
|
|
180
447
|
// Check if number starts with any mobile prefix
|
|
181
|
-
|
|
448
|
+
// Sort prefixes by length (longest first) to match longer prefixes first
|
|
449
|
+
const sortedPrefixes = [...rules.mobilePrefixes].sort((a, b) => b.length - a.length);
|
|
450
|
+
for (const prefix of sortedPrefixes) {
|
|
182
451
|
if (nationalNumber.startsWith(prefix)) {
|
|
183
452
|
return true;
|
|
184
453
|
}
|
|
185
454
|
}
|
|
186
|
-
// If
|
|
187
|
-
|
|
188
|
-
for (const prefix of rules.landlinePrefixes) {
|
|
189
|
-
if (nationalNumber.startsWith(prefix)) {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
// If we have mobile prefixes but number doesn't match, it might be invalid
|
|
195
|
-
// Return undefined to let other validation handle it
|
|
196
|
-
return undefined;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Check if a number is a landline number based on country-specific prefix rules
|
|
200
|
-
*/
|
|
201
|
-
function isLandlineNumber(countryCode, nationalNumber) {
|
|
202
|
-
const rules = exports.MOBILE_PREFIX_RULES[countryCode];
|
|
203
|
-
if (!rules) {
|
|
204
|
-
return undefined;
|
|
205
|
-
}
|
|
206
|
-
// If landline prefixes are defined, check them
|
|
207
|
-
if (rules.landlinePrefixes && rules.landlinePrefixes.length > 0) {
|
|
208
|
-
for (const prefix of rules.landlinePrefixes) {
|
|
209
|
-
if (nationalNumber.startsWith(prefix)) {
|
|
210
|
-
return true;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
// If mobile prefixes are defined and number doesn't match mobile, might be landline
|
|
215
|
-
if (rules.mobilePrefixes.length > 0) {
|
|
216
|
-
let matchesMobile = false;
|
|
217
|
-
for (const prefix of rules.mobilePrefixes) {
|
|
218
|
-
if (nationalNumber.startsWith(prefix)) {
|
|
219
|
-
matchesMobile = true;
|
|
220
|
-
break;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
if (!matchesMobile) {
|
|
224
|
-
return true; // Not mobile, likely landline
|
|
225
|
-
}
|
|
226
|
-
}
|
|
455
|
+
// If we have mobile prefixes but number doesn't match, return undefined
|
|
456
|
+
// This allows other validation to handle it
|
|
227
457
|
return undefined;
|
|
228
458
|
}
|
|
229
|
-
//# sourceMappingURL=mobilePrefixes.js.map
|