@modernman00/shared-js-lib 1.2.2 → 1.2.6

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.
Files changed (2) hide show
  1. package/CountryCode.js +203 -205
  2. package/package.json +3 -2
package/CountryCode.js CHANGED
@@ -1,214 +1,212 @@
1
- import {id} from "./UtilityHtml.js";
1
+ import { id } from './UtilityHtml.js';
2
2
 
3
3
  // inject the country code once one of the country is picked
4
4
 
5
5
  // Object to map countries to country codes
6
6
 
7
7
  const countryCodes = {
8
- Afghanistan: "93",
9
- Albania: "355",
10
- Algeria: "213",
11
- Andorra: "376",
12
- Angola: "244",
13
- "Antigua and Barbuda": "1-268",
14
- Argentina: "54",
15
- Armenia: "374",
16
- Australia: "61",
17
- Austria: "43",
18
- Azerbaijan: "994",
19
- Bahamas: "1-242",
20
- Bahrain: "973",
21
- Bangladesh: "880",
22
- Barbados: "1-246",
23
- Belarus: "375",
24
- Belgium: "32",
25
- Belize: "501",
26
- Benin: "229",
27
- Bhutan: "975",
28
- Bolivia: "591",
29
- "Bosnia and Herzegovina": "387",
30
- Botswana: "267",
31
- Brazil: "55",
32
- Brunei: "673",
33
- Bulgaria: "359",
34
- "Burkina Faso": "226",
35
- Burundi: "257",
36
- Cambodia: "855",
37
- Cameroon: "237",
38
- Canada: "1",
39
- "Cape Verde": "238",
40
- "Central African Republic": "236",
41
- Chad: "235",
42
- Chile: "56",
43
- China: "86",
44
- Colombia: "57",
45
- Comoros: "269",
46
- "Congo (Brazzaville)": "242",
47
- "Congo (Kinshasa)": "243",
48
- "Costa Rica": "506",
49
- "Côte d'Ivoire": "225",
50
- Croatia: "385",
51
- Cuba: "53",
52
- Cyprus: "357",
53
- "Czech Republic": "420",
54
- Denmark: "45",
55
- Djibouti: "253",
56
- Dominica: "1-767",
57
- "Dominican Republic": "1-809, 1-829, 1-849",
58
- "East Timor": "670",
59
- Ecuador: "593",
60
- Egypt: "20",
61
- "El Salvador": "503",
62
- "Equatorial Guinea": "240",
63
- Eritrea: "291",
64
- Estonia: "372",
65
- Ethiopia: "251",
66
- Fiji: "679",
67
- Finland: "358",
68
- France: "33",
69
- Gabon: "241",
70
- Gambia: "220",
71
- Georgia: "995",
72
- Germany: "49",
73
- Ghana: "233",
74
- Greece: "30",
75
- Grenada: "1-473",
76
- Guatemala: "502",
77
- Guinea: "224",
78
- "Guinea-Bissau": "245",
79
- Guyana: "592",
80
- Haiti: "509",
81
- Honduras: "504",
82
- Hungary: "36",
83
- Iceland: "354",
84
- India: "91",
85
- Indonesia: "62",
86
- Iran: "98",
87
- Iraq: "964",
88
- Ireland: "353",
89
- Israel: "972",
90
- Italy: "39",
91
- Jamaica: "1-876",
92
- Japan: "81",
93
- Jordan: "962",
94
- Kazakhstan: "7",
95
- Kenya: "254",
96
- Kiribati: "686",
97
- "North Korea": "850",
98
- "South Korea": "82",
99
- Kosovo: "383",
100
- Kuwait: "965",
101
- Kyrgyzstan: "996",
102
- Laos: "856",
103
- Latvia: "371",
104
- Lebanon: "961",
105
- Lesotho: "266",
106
- Liberia: "231",
107
- Libya: "218",
108
- Liechtenstein: "423",
109
- Lithuania: "370",
110
- Luxembourg: "352",
111
- Macedonia: "389",
112
- Madagascar: "261",
113
- Malawi: "265",
114
- Malaysia: "60",
115
- Maldives: "960",
116
- Mali: "223",
117
- Malta: "356",
118
- "Marshall Islands": "692",
119
- Mauritania: "222",
120
- Mauritius: "230",
121
- Mexico: "52",
122
- Micronesia: "691",
123
- Moldova: "373",
124
- Monaco: "377",
125
- Mongolia: "976",
126
- Montenegro: "382",
127
- Morocco: "212",
128
- Mozambique: "258",
129
- Myanmar: "95",
130
- Namibia: "264",
131
- Nauru: "674",
132
- Nepal: "977",
133
- Netherlands: "31",
134
- "New Zealand": "64",
135
- Nicaragua: "505",
136
- Niger: "227",
137
- Nigeria: "234",
138
- Norway: "47",
139
- Oman: "968",
140
- Pakistan: "92",
141
- Palau: "680",
142
- Panama: "507",
143
- "Papua New Guinea": "675",
144
- Paraguay: "595",
145
- Peru: "51",
146
- Philippines: "63",
147
- Poland: "48",
148
- Portugal: "351",
149
- Qatar: "974",
150
- Romania: "40",
151
- Russia: "7",
152
- Rwanda: "250",
153
- "Saint Kitts and Nevis": "1-869",
154
- "Saint Lucia": "1-758",
155
- "Saint Vincent and the Grenadines": "1-784",
156
- Samoa: "685",
157
- "San Marino": "378",
158
- "Sao Tome and Principe": "239",
159
- "Saudi Arabia": "966",
160
- Senegal: "221",
161
- Serbia: "381",
162
- Seychelles: "248",
163
- "Sierra Leone": "232",
164
- Singapore: "65",
165
- Slovakia: "421",
166
- Slovenia: "386",
167
- "Solomon Islands": "677",
168
- Somalia: "252",
169
- "South Africa": "27",
170
- "South Sudan": "211",
171
- Spain: "34",
172
- "Sri Lanka": "94",
173
- Sudan: "249",
174
- Suriname: "597",
175
- Swaziland: "268",
176
- Sweden: "46",
177
- Switzerland: "41",
178
- Syria: "963",
179
- Taiwan: "886",
180
- Tajikistan: "992",
181
- Tanzania: "255",
182
- Thailand: "66",
183
- Togo: "228",
184
- Tonga: "676",
185
- "Trinidad and Tobago": "1-868",
186
- Tunisia: "216",
187
- Turkey: "90",
188
- Turkmenistan: "993",
189
- Tuvalu: "688",
190
- Uganda: "256",
191
- Ukraine: "380",
192
- "United Arab Emirates": "971",
193
- "United Kingdom": "44",
194
- "United States": "1",
195
- Uruguay: "598",
196
- Uzbekistan: "998",
197
- Vanuatu: "678",
198
- "Vatican City": "379",
199
- Venezuela: "58",
200
- Vietnam: "84",
201
- Yemen: "967",
202
- Zambia: "260",
203
- Zimbabwe: "263"
204
- }
205
-
8
+ Afghanistan: '93',
9
+ Albania: '355',
10
+ Algeria: '213',
11
+ Andorra: '376',
12
+ Angola: '244',
13
+ 'Antigua and Barbuda': '1-268',
14
+ Argentina: '54',
15
+ Armenia: '374',
16
+ Australia: '61',
17
+ Austria: '43',
18
+ Azerbaijan: '994',
19
+ Bahamas: '1-242',
20
+ Bahrain: '973',
21
+ Bangladesh: '880',
22
+ Barbados: '1-246',
23
+ Belarus: '375',
24
+ Belgium: '32',
25
+ Belize: '501',
26
+ Benin: '229',
27
+ Bhutan: '975',
28
+ Bolivia: '591',
29
+ 'Bosnia and Herzegovina': '387',
30
+ Botswana: '267',
31
+ Brazil: '55',
32
+ Brunei: '673',
33
+ Bulgaria: '359',
34
+ 'Burkina Faso': '226',
35
+ Burundi: '257',
36
+ Cambodia: '855',
37
+ Cameroon: '237',
38
+ Canada: '1',
39
+ 'Cape Verde': '238',
40
+ 'Central African Republic': '236',
41
+ Chad: '235',
42
+ Chile: '56',
43
+ China: '86',
44
+ Colombia: '57',
45
+ Comoros: '269',
46
+ 'Congo (Brazzaville)': '242',
47
+ 'Congo (Kinshasa)': '243',
48
+ 'Costa Rica': '506',
49
+ "Côte d'Ivoire": '225',
50
+ Croatia: '385',
51
+ Cuba: '53',
52
+ Cyprus: '357',
53
+ 'Czech Republic': '420',
54
+ Denmark: '45',
55
+ Djibouti: '253',
56
+ Dominica: '1-767',
57
+ 'Dominican Republic': '1-809, 1-829, 1-849',
58
+ 'East Timor': '670',
59
+ Ecuador: '593',
60
+ Egypt: '20',
61
+ 'El Salvador': '503',
62
+ 'Equatorial Guinea': '240',
63
+ Eritrea: '291',
64
+ Estonia: '372',
65
+ Ethiopia: '251',
66
+ Fiji: '679',
67
+ Finland: '358',
68
+ France: '33',
69
+ Gabon: '241',
70
+ Gambia: '220',
71
+ Georgia: '995',
72
+ Germany: '49',
73
+ Ghana: '233',
74
+ Greece: '30',
75
+ Grenada: '1-473',
76
+ Guatemala: '502',
77
+ Guinea: '224',
78
+ 'Guinea-Bissau': '245',
79
+ Guyana: '592',
80
+ Haiti: '509',
81
+ Honduras: '504',
82
+ Hungary: '36',
83
+ Iceland: '354',
84
+ India: '91',
85
+ Indonesia: '62',
86
+ Iran: '98',
87
+ Iraq: '964',
88
+ Ireland: '353',
89
+ Israel: '972',
90
+ Italy: '39',
91
+ Jamaica: '1-876',
92
+ Japan: '81',
93
+ Jordan: '962',
94
+ Kazakhstan: '7',
95
+ Kenya: '254',
96
+ Kiribati: '686',
97
+ 'North Korea': '850',
98
+ 'South Korea': '82',
99
+ Kosovo: '383',
100
+ Kuwait: '965',
101
+ Kyrgyzstan: '996',
102
+ Laos: '856',
103
+ Latvia: '371',
104
+ Lebanon: '961',
105
+ Lesotho: '266',
106
+ Liberia: '231',
107
+ Libya: '218',
108
+ Liechtenstein: '423',
109
+ Lithuania: '370',
110
+ Luxembourg: '352',
111
+ Macedonia: '389',
112
+ Madagascar: '261',
113
+ Malawi: '265',
114
+ Malaysia: '60',
115
+ Maldives: '960',
116
+ Mali: '223',
117
+ Malta: '356',
118
+ 'Marshall Islands': '692',
119
+ Mauritania: '222',
120
+ Mauritius: '230',
121
+ Mexico: '52',
122
+ Micronesia: '691',
123
+ Moldova: '373',
124
+ Monaco: '377',
125
+ Mongolia: '976',
126
+ Montenegro: '382',
127
+ Morocco: '212',
128
+ Mozambique: '258',
129
+ Myanmar: '95',
130
+ Namibia: '264',
131
+ Nauru: '674',
132
+ Nepal: '977',
133
+ Netherlands: '31',
134
+ 'New Zealand': '64',
135
+ Nicaragua: '505',
136
+ Niger: '227',
137
+ Nigeria: '234',
138
+ Norway: '47',
139
+ Oman: '968',
140
+ Pakistan: '92',
141
+ Palau: '680',
142
+ Panama: '507',
143
+ 'Papua New Guinea': '675',
144
+ Paraguay: '595',
145
+ Peru: '51',
146
+ Philippines: '63',
147
+ Poland: '48',
148
+ Portugal: '351',
149
+ Qatar: '974',
150
+ Romania: '40',
151
+ Russia: '7',
152
+ Rwanda: '250',
153
+ 'Saint Kitts and Nevis': '1-869',
154
+ 'Saint Lucia': '1-758',
155
+ 'Saint Vincent and the Grenadines': '1-784',
156
+ Samoa: '685',
157
+ 'San Marino': '378',
158
+ 'Sao Tome and Principe': '239',
159
+ 'Saudi Arabia': '966',
160
+ Senegal: '221',
161
+ Serbia: '381',
162
+ Seychelles: '248',
163
+ 'Sierra Leone': '232',
164
+ Singapore: '65',
165
+ Slovakia: '421',
166
+ Slovenia: '386',
167
+ 'Solomon Islands': '677',
168
+ Somalia: '252',
169
+ 'South Africa': '27',
170
+ 'South Sudan': '211',
171
+ Spain: '34',
172
+ 'Sri Lanka': '94',
173
+ Sudan: '249',
174
+ Suriname: '597',
175
+ Swaziland: '268',
176
+ Sweden: '46',
177
+ Switzerland: '41',
178
+ Syria: '963',
179
+ Taiwan: '886',
180
+ Tajikistan: '992',
181
+ Tanzania: '255',
182
+ Thailand: '66',
183
+ Togo: '228',
184
+ Tonga: '676',
185
+ 'Trinidad and Tobago': '1-868',
186
+ Tunisia: '216',
187
+ Turkey: '90',
188
+ Turkmenistan: '993',
189
+ Tuvalu: '688',
190
+ Uganda: '256',
191
+ Ukraine: '380',
192
+ 'United Arab Emirates': '971',
193
+ 'United Kingdom': '44',
194
+ 'United States': '1',
195
+ Uruguay: '598',
196
+ Uzbekistan: '998',
197
+ Vanuatu: '678',
198
+ 'Vatican City': '379',
199
+ Venezuela: '58',
200
+ Vietnam: '84',
201
+ Yemen: '967',
202
+ Zambia: '260',
203
+ Zimbabwe: '263',
204
+ };
206
205
 
207
206
  export const injectCountryCode = async (countryId, mobileId) => {
208
- id(countryId).addEventListener('change', async (e) => {
209
- const value = e.target.value;
210
- id(mobileId).value = await countryCodes[value] || '';
211
- });
207
+ if (countryId !== null && mobileId !== null)
208
+ id(countryId).addEventListener('change', async (e) => {
209
+ const value = e.target.value;
210
+ id(mobileId).value = (await countryCodes[value]) || '';
211
+ });
212
212
  };
213
-
214
- injectCountryCode();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernman00/shared-js-lib",
3
- "version": "1.2.2",
3
+ "version": "1.2.6",
4
4
  "description": "Reusable JS utilities for numerous js problems",
5
5
  "homepage": "https://github.com/modernman00/shared-js-lib#readme",
6
6
  "keywords": [
@@ -25,7 +25,8 @@
25
25
  "dependencies": {
26
26
  "axios": "^1.9.0",
27
27
  "axios-retry": "^4.5.0"
28
- }, "publishConfig": {
28
+ },
29
+ "publishConfig": {
29
30
  "access": "public"
30
31
  }
31
32
  }