tele_number_utils 1.0.3 → 1.0.5
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 +0 -4
- package/dist/country/getCountry.d.ts.map +1 -1
- package/dist/country/getCountry.js +39 -1
- package/dist/country/util.d.ts +19 -0
- package/dist/country/util.d.ts.map +1 -1
- package/dist/country/util.js +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -195,10 +195,6 @@ Feel free to open an issue or PR to improve country detection, formatting option
|
|
|
195
195
|
|
|
196
196
|
If this package helps you, you can support my work ❤️
|
|
197
197
|
|
|
198
|
-
### 💳 Payoneer
|
|
199
|
-
|
|
200
|
-
If you prefer Payoneer, you can send support to:
|
|
201
|
-
|
|
202
198
|
- **Payoneer Email:** p7894727@gmail.com
|
|
203
199
|
|
|
204
200
|
(Thank you for your support 🙏)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCountry.d.ts","sourceRoot":"","sources":["../../src/country/getCountry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCountry.d.ts","sourceRoot":"","sources":["../../src/country/getCountry.ts"],"names":[],"mappings":"AA6BA,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAuEF,oBAAoB;AACpB,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,KAAG,OAuB3C,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parsePhoneNumber } from "../parsed";
|
|
2
2
|
import { country_list } from "./country";
|
|
3
|
-
import { UK_COUNTRY_CODE, UK_DEPENDENCIES, CANADIAN_AREA_CODES, US_CANADA_COUNTRY_CODE, PUERTO_RICO_COUNTRY_CODE, } from "./util";
|
|
3
|
+
import { UK_COUNTRY_CODE, UK_DEPENDENCIES, CANADIAN_AREA_CODES, US_CANADA_COUNTRY_CODE, PUERTO_RICO_COUNTRY_CODE, AMERICAN_SAMOA_AREA_CODE, ANGUILLA_AREA_CODE, ANTIGUA_AND_BARBUDA_AREA_CODE, BAHAMAS_AREA_CODE, BARBADOS_AREA_CODE, BERMUDA_AREA_CODE, BRITISH_VIRGIN_ISLANDS_AREA_CODE, CAYMAN_ISLANDS_AREA_CODE, DOMINICAN_REPUBLIC_AREA_CODE, GRENADA_AREA_CODE, JAMAICA_AREA_CODE, MONTSERRAT_AREA_CODE, SAINT_KITTS_AND_NEVIS_AREA_CODE, SAINT_LUCIA_AREA_CODE, SAINT_VINCENT_AND_THE_GRENADINES_AREA_CODE, SINT_MAARTEN_AREA_CODE, TRINIDAD_AND_TOBAGO_AREA_CODE, TURKS_AND_CAICOS_ISLANDS_AREA_CODE, UNITED_STATES_VIRGIN_ISLANDS_AREA_CODE, } from "./util";
|
|
4
4
|
const NOT_FOUND_RESULT = {
|
|
5
5
|
name: "Not found",
|
|
6
6
|
dialingCode: "Invalid dialing code",
|
|
@@ -16,6 +16,44 @@ const handleUSCanada = (nationalNumber) => {
|
|
|
16
16
|
const areaCode = nationalNumber.slice(0, 3);
|
|
17
17
|
if (PUERTO_RICO_COUNTRY_CODE.includes(areaCode))
|
|
18
18
|
return getCountryByAlpha("PR");
|
|
19
|
+
if (AMERICAN_SAMOA_AREA_CODE.includes(areaCode))
|
|
20
|
+
return getCountryByAlpha("AS");
|
|
21
|
+
if (ANGUILLA_AREA_CODE.includes(areaCode))
|
|
22
|
+
return getCountryByAlpha("AI");
|
|
23
|
+
if (ANTIGUA_AND_BARBUDA_AREA_CODE.includes(areaCode))
|
|
24
|
+
return getCountryByAlpha("AG");
|
|
25
|
+
if (BAHAMAS_AREA_CODE.includes(areaCode))
|
|
26
|
+
return getCountryByAlpha("BS");
|
|
27
|
+
if (BARBADOS_AREA_CODE.includes(areaCode))
|
|
28
|
+
return getCountryByAlpha("BB");
|
|
29
|
+
if (BERMUDA_AREA_CODE.includes(areaCode))
|
|
30
|
+
return getCountryByAlpha("BM");
|
|
31
|
+
if (BRITISH_VIRGIN_ISLANDS_AREA_CODE.includes(areaCode))
|
|
32
|
+
return getCountryByAlpha("VG");
|
|
33
|
+
if (CAYMAN_ISLANDS_AREA_CODE.includes(areaCode))
|
|
34
|
+
return getCountryByAlpha("KY");
|
|
35
|
+
if (DOMINICAN_REPUBLIC_AREA_CODE.includes(areaCode))
|
|
36
|
+
return getCountryByAlpha("DO");
|
|
37
|
+
if (GRENADA_AREA_CODE.includes(areaCode))
|
|
38
|
+
return getCountryByAlpha("GD");
|
|
39
|
+
if (JAMAICA_AREA_CODE.includes(areaCode))
|
|
40
|
+
return getCountryByAlpha("JM");
|
|
41
|
+
if (MONTSERRAT_AREA_CODE.includes(areaCode))
|
|
42
|
+
return getCountryByAlpha("MS");
|
|
43
|
+
if (SAINT_KITTS_AND_NEVIS_AREA_CODE.includes(areaCode))
|
|
44
|
+
return getCountryByAlpha("KN");
|
|
45
|
+
if (SAINT_LUCIA_AREA_CODE.includes(areaCode))
|
|
46
|
+
return getCountryByAlpha("LC");
|
|
47
|
+
if (SAINT_VINCENT_AND_THE_GRENADINES_AREA_CODE.includes(areaCode))
|
|
48
|
+
return getCountryByAlpha("VC");
|
|
49
|
+
if (SINT_MAARTEN_AREA_CODE.includes(areaCode))
|
|
50
|
+
return getCountryByAlpha("SX");
|
|
51
|
+
if (TRINIDAD_AND_TOBAGO_AREA_CODE.includes(areaCode))
|
|
52
|
+
return getCountryByAlpha("TT");
|
|
53
|
+
if (TURKS_AND_CAICOS_ISLANDS_AREA_CODE.includes(areaCode))
|
|
54
|
+
return getCountryByAlpha("TC");
|
|
55
|
+
if (UNITED_STATES_VIRGIN_ISLANDS_AREA_CODE.includes(areaCode))
|
|
56
|
+
return getCountryByAlpha("VI");
|
|
19
57
|
if (CANADIAN_AREA_CODES.includes(areaCode))
|
|
20
58
|
return getCountryByAlpha("CA");
|
|
21
59
|
return getCountryByAlpha("US");
|
package/dist/country/util.d.ts
CHANGED
|
@@ -26,4 +26,23 @@ export declare const UK_DEPENDENCIES: {
|
|
|
26
26
|
}[];
|
|
27
27
|
export declare const US_CANADA_COUNTRY_CODE = "1";
|
|
28
28
|
export declare const PUERTO_RICO_COUNTRY_CODE: string[];
|
|
29
|
+
export declare const AMERICAN_SAMOA_AREA_CODE: string[];
|
|
30
|
+
export declare const ANGUILLA_AREA_CODE: string[];
|
|
31
|
+
export declare const ANTIGUA_AND_BARBUDA_AREA_CODE: string[];
|
|
32
|
+
export declare const BAHAMAS_AREA_CODE: string[];
|
|
33
|
+
export declare const BARBADOS_AREA_CODE: string[];
|
|
34
|
+
export declare const BERMUDA_AREA_CODE: string[];
|
|
35
|
+
export declare const BRITISH_VIRGIN_ISLANDS_AREA_CODE: string[];
|
|
36
|
+
export declare const CAYMAN_ISLANDS_AREA_CODE: string[];
|
|
37
|
+
export declare const DOMINICAN_REPUBLIC_AREA_CODE: string[];
|
|
38
|
+
export declare const GRENADA_AREA_CODE: string[];
|
|
39
|
+
export declare const JAMAICA_AREA_CODE: string[];
|
|
40
|
+
export declare const MONTSERRAT_AREA_CODE: string[];
|
|
41
|
+
export declare const SAINT_KITTS_AND_NEVIS_AREA_CODE: string[];
|
|
42
|
+
export declare const SAINT_LUCIA_AREA_CODE: string[];
|
|
43
|
+
export declare const SAINT_VINCENT_AND_THE_GRENADINES_AREA_CODE: string[];
|
|
44
|
+
export declare const SINT_MAARTEN_AREA_CODE: string[];
|
|
45
|
+
export declare const TRINIDAD_AND_TOBAGO_AREA_CODE: string[];
|
|
46
|
+
export declare const TURKS_AND_CAICOS_ISLANDS_AREA_CODE: string[];
|
|
47
|
+
export declare const UNITED_STATES_VIRGIN_ISLANDS_AREA_CODE: string[];
|
|
29
48
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/country/util.ts"],"names":[],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AAC;AACvD,eAAO,MAAM,qBAAqB,UAAU,CAAC;AAC7C,eAAO,MAAM,0CAA0C,UAAU,CAAC;AAClE,eAAO,MAAM,sBAAsB,UAAU,CAAC;AAC9C,eAAO,MAAM,6BAA6B,UAAU,CAAC;AACrD,eAAO,MAAM,kCAAkC,UAAU,CAAC;AAC1D,eAAO,MAAM,sCAAsC,UAAU,CAAC"}
|
package/dist/country/util.js
CHANGED
|
@@ -66,3 +66,22 @@ export const CANADIAN_AREA_CODES = [
|
|
|
66
66
|
export const UK_DEPENDENCIES = [ISLE_OF_MAN, JERSEY, GUERNSEY];
|
|
67
67
|
export const US_CANADA_COUNTRY_CODE = "1";
|
|
68
68
|
export const PUERTO_RICO_COUNTRY_CODE = ["787", "939"];
|
|
69
|
+
export const AMERICAN_SAMOA_AREA_CODE = ["684"];
|
|
70
|
+
export const ANGUILLA_AREA_CODE = ["264"];
|
|
71
|
+
export const ANTIGUA_AND_BARBUDA_AREA_CODE = ["268"];
|
|
72
|
+
export const BAHAMAS_AREA_CODE = ["242"];
|
|
73
|
+
export const BARBADOS_AREA_CODE = ["246"];
|
|
74
|
+
export const BERMUDA_AREA_CODE = ["441"];
|
|
75
|
+
export const BRITISH_VIRGIN_ISLANDS_AREA_CODE = ["284"];
|
|
76
|
+
export const CAYMAN_ISLANDS_AREA_CODE = ["345"];
|
|
77
|
+
export const DOMINICAN_REPUBLIC_AREA_CODE = ["809", "829", "849"];
|
|
78
|
+
export const GRENADA_AREA_CODE = ["473"];
|
|
79
|
+
export const JAMAICA_AREA_CODE = ["658", "876"];
|
|
80
|
+
export const MONTSERRAT_AREA_CODE = ["664"];
|
|
81
|
+
export const SAINT_KITTS_AND_NEVIS_AREA_CODE = ["869"];
|
|
82
|
+
export const SAINT_LUCIA_AREA_CODE = ["758"];
|
|
83
|
+
export const SAINT_VINCENT_AND_THE_GRENADINES_AREA_CODE = ["784"];
|
|
84
|
+
export const SINT_MAARTEN_AREA_CODE = ["721"];
|
|
85
|
+
export const TRINIDAD_AND_TOBAGO_AREA_CODE = ["868"];
|
|
86
|
+
export const TURKS_AND_CAICOS_ISLANDS_AREA_CODE = ["649"];
|
|
87
|
+
export const UNITED_STATES_VIRGIN_ISLANDS_AREA_CODE = ["340"];
|