@martince/countries 0.1.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/README.md +115 -0
- package/dist/chunk-7VNZ5TNZ.js +265 -0
- package/dist/chunk-7VNZ5TNZ.js.map +1 -0
- package/dist/countries/index.d.ts +263 -0
- package/dist/countries/index.js +256 -0
- package/dist/countries/index.js.map +1 -0
- package/dist/index.d.ts +133 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/regions/index.d.ts +118 -0
- package/dist/regions/index.js +364 -0
- package/dist/regions/index.js.map +1 -0
- package/dist/types/index.d.ts +117 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { countries } from '../chunk-7VNZ5TNZ.js';
|
|
2
|
+
|
|
3
|
+
// src/regions/index.ts
|
|
4
|
+
var EU_MEMBERS = [
|
|
5
|
+
"AT",
|
|
6
|
+
// Austria
|
|
7
|
+
"BE",
|
|
8
|
+
// Belgium
|
|
9
|
+
"BG",
|
|
10
|
+
// Bulgaria
|
|
11
|
+
"HR",
|
|
12
|
+
// Croatia
|
|
13
|
+
"CY",
|
|
14
|
+
// Cyprus
|
|
15
|
+
"CZ",
|
|
16
|
+
// Czechia
|
|
17
|
+
"DK",
|
|
18
|
+
// Denmark
|
|
19
|
+
"EE",
|
|
20
|
+
// Estonia
|
|
21
|
+
"FI",
|
|
22
|
+
// Finland
|
|
23
|
+
"FR",
|
|
24
|
+
// France
|
|
25
|
+
"DE",
|
|
26
|
+
// Germany
|
|
27
|
+
"GR",
|
|
28
|
+
// Greece
|
|
29
|
+
"HU",
|
|
30
|
+
// Hungary
|
|
31
|
+
"IE",
|
|
32
|
+
// Ireland
|
|
33
|
+
"IT",
|
|
34
|
+
// Italy
|
|
35
|
+
"LV",
|
|
36
|
+
// Latvia
|
|
37
|
+
"LT",
|
|
38
|
+
// Lithuania
|
|
39
|
+
"LU",
|
|
40
|
+
// Luxembourg
|
|
41
|
+
"MT",
|
|
42
|
+
// Malta
|
|
43
|
+
"NL",
|
|
44
|
+
// Netherlands
|
|
45
|
+
"PL",
|
|
46
|
+
// Poland
|
|
47
|
+
"PT",
|
|
48
|
+
// Portugal
|
|
49
|
+
"RO",
|
|
50
|
+
// Romania
|
|
51
|
+
"SK",
|
|
52
|
+
// Slovakia
|
|
53
|
+
"SI",
|
|
54
|
+
// Slovenia
|
|
55
|
+
"ES",
|
|
56
|
+
// Spain
|
|
57
|
+
"SE"
|
|
58
|
+
// Sweden
|
|
59
|
+
];
|
|
60
|
+
var SCHENGEN_AREA = [
|
|
61
|
+
"AT",
|
|
62
|
+
// Austria
|
|
63
|
+
"BE",
|
|
64
|
+
// Belgium
|
|
65
|
+
"HR",
|
|
66
|
+
// Croatia
|
|
67
|
+
"CZ",
|
|
68
|
+
// Czechia
|
|
69
|
+
"DK",
|
|
70
|
+
// Denmark
|
|
71
|
+
"EE",
|
|
72
|
+
// Estonia
|
|
73
|
+
"FI",
|
|
74
|
+
// Finland
|
|
75
|
+
"FR",
|
|
76
|
+
// France
|
|
77
|
+
"DE",
|
|
78
|
+
// Germany
|
|
79
|
+
"GR",
|
|
80
|
+
// Greece
|
|
81
|
+
"HU",
|
|
82
|
+
// Hungary
|
|
83
|
+
"IS",
|
|
84
|
+
// Iceland (not EU)
|
|
85
|
+
"IT",
|
|
86
|
+
// Italy
|
|
87
|
+
"LV",
|
|
88
|
+
// Latvia
|
|
89
|
+
"LI",
|
|
90
|
+
// Liechtenstein (not EU)
|
|
91
|
+
"LT",
|
|
92
|
+
// Lithuania
|
|
93
|
+
"LU",
|
|
94
|
+
// Luxembourg
|
|
95
|
+
"MT",
|
|
96
|
+
// Malta
|
|
97
|
+
"NL",
|
|
98
|
+
// Netherlands
|
|
99
|
+
"NO",
|
|
100
|
+
// Norway (not EU)
|
|
101
|
+
"PL",
|
|
102
|
+
// Poland
|
|
103
|
+
"PT",
|
|
104
|
+
// Portugal
|
|
105
|
+
"SK",
|
|
106
|
+
// Slovakia
|
|
107
|
+
"SI",
|
|
108
|
+
// Slovenia
|
|
109
|
+
"ES",
|
|
110
|
+
// Spain
|
|
111
|
+
"SE",
|
|
112
|
+
// Sweden
|
|
113
|
+
"CH"
|
|
114
|
+
// Switzerland (not EU)
|
|
115
|
+
];
|
|
116
|
+
var NATO_MEMBERS = [
|
|
117
|
+
"AL",
|
|
118
|
+
// Albania
|
|
119
|
+
"BE",
|
|
120
|
+
// Belgium
|
|
121
|
+
"BG",
|
|
122
|
+
// Bulgaria
|
|
123
|
+
"CA",
|
|
124
|
+
// Canada
|
|
125
|
+
"HR",
|
|
126
|
+
// Croatia
|
|
127
|
+
"CZ",
|
|
128
|
+
// Czechia
|
|
129
|
+
"DK",
|
|
130
|
+
// Denmark
|
|
131
|
+
"EE",
|
|
132
|
+
// Estonia
|
|
133
|
+
"FI",
|
|
134
|
+
// Finland
|
|
135
|
+
"FR",
|
|
136
|
+
// France
|
|
137
|
+
"DE",
|
|
138
|
+
// Germany
|
|
139
|
+
"GR",
|
|
140
|
+
// Greece
|
|
141
|
+
"HU",
|
|
142
|
+
// Hungary
|
|
143
|
+
"IS",
|
|
144
|
+
// Iceland
|
|
145
|
+
"IT",
|
|
146
|
+
// Italy
|
|
147
|
+
"LV",
|
|
148
|
+
// Latvia
|
|
149
|
+
"LT",
|
|
150
|
+
// Lithuania
|
|
151
|
+
"LU",
|
|
152
|
+
// Luxembourg
|
|
153
|
+
"ME",
|
|
154
|
+
// Montenegro
|
|
155
|
+
"NL",
|
|
156
|
+
// Netherlands
|
|
157
|
+
"MK",
|
|
158
|
+
// North Macedonia
|
|
159
|
+
"NO",
|
|
160
|
+
// Norway
|
|
161
|
+
"PL",
|
|
162
|
+
// Poland
|
|
163
|
+
"PT",
|
|
164
|
+
// Portugal
|
|
165
|
+
"RO",
|
|
166
|
+
// Romania
|
|
167
|
+
"SK",
|
|
168
|
+
// Slovakia
|
|
169
|
+
"SI",
|
|
170
|
+
// Slovenia
|
|
171
|
+
"ES",
|
|
172
|
+
// Spain
|
|
173
|
+
"SE",
|
|
174
|
+
// Sweden
|
|
175
|
+
"TR",
|
|
176
|
+
// Türkiye
|
|
177
|
+
"GB",
|
|
178
|
+
// United Kingdom
|
|
179
|
+
"US"
|
|
180
|
+
// United States
|
|
181
|
+
];
|
|
182
|
+
var G7_MEMBERS = [
|
|
183
|
+
"CA",
|
|
184
|
+
// Canada
|
|
185
|
+
"FR",
|
|
186
|
+
// France
|
|
187
|
+
"DE",
|
|
188
|
+
// Germany
|
|
189
|
+
"IT",
|
|
190
|
+
// Italy
|
|
191
|
+
"JP",
|
|
192
|
+
// Japan
|
|
193
|
+
"GB",
|
|
194
|
+
// United Kingdom
|
|
195
|
+
"US"
|
|
196
|
+
// United States
|
|
197
|
+
];
|
|
198
|
+
var G20_MEMBERS = [
|
|
199
|
+
"AR",
|
|
200
|
+
// Argentina
|
|
201
|
+
"AU",
|
|
202
|
+
// Australia
|
|
203
|
+
"BR",
|
|
204
|
+
// Brazil
|
|
205
|
+
"CA",
|
|
206
|
+
// Canada
|
|
207
|
+
"CN",
|
|
208
|
+
// China
|
|
209
|
+
"FR",
|
|
210
|
+
// France
|
|
211
|
+
"DE",
|
|
212
|
+
// Germany
|
|
213
|
+
"IN",
|
|
214
|
+
// India
|
|
215
|
+
"ID",
|
|
216
|
+
// Indonesia
|
|
217
|
+
"IT",
|
|
218
|
+
// Italy
|
|
219
|
+
"JP",
|
|
220
|
+
// Japan
|
|
221
|
+
"MX",
|
|
222
|
+
// Mexico
|
|
223
|
+
"RU",
|
|
224
|
+
// Russia
|
|
225
|
+
"SA",
|
|
226
|
+
// Saudi Arabia
|
|
227
|
+
"ZA",
|
|
228
|
+
// South Africa
|
|
229
|
+
"KR",
|
|
230
|
+
// South Korea
|
|
231
|
+
"TR",
|
|
232
|
+
// Türkiye
|
|
233
|
+
"GB",
|
|
234
|
+
// United Kingdom
|
|
235
|
+
"US"
|
|
236
|
+
// United States
|
|
237
|
+
// EU is also a member but represented by code, not included here as it's not a country
|
|
238
|
+
];
|
|
239
|
+
var BRICS_MEMBERS = [
|
|
240
|
+
"BR",
|
|
241
|
+
// Brazil
|
|
242
|
+
"RU",
|
|
243
|
+
// Russia
|
|
244
|
+
"IN",
|
|
245
|
+
// India
|
|
246
|
+
"CN",
|
|
247
|
+
// China
|
|
248
|
+
"ZA",
|
|
249
|
+
// South Africa
|
|
250
|
+
"EG",
|
|
251
|
+
// Egypt (2024)
|
|
252
|
+
"ET",
|
|
253
|
+
// Ethiopia (2024)
|
|
254
|
+
"IR",
|
|
255
|
+
// Iran (2024)
|
|
256
|
+
"AE"
|
|
257
|
+
// United Arab Emirates (2024)
|
|
258
|
+
];
|
|
259
|
+
var ASEAN_MEMBERS = [
|
|
260
|
+
"BN",
|
|
261
|
+
// Brunei
|
|
262
|
+
"KH",
|
|
263
|
+
// Cambodia
|
|
264
|
+
"ID",
|
|
265
|
+
// Indonesia
|
|
266
|
+
"LA",
|
|
267
|
+
// Laos
|
|
268
|
+
"MY",
|
|
269
|
+
// Malaysia
|
|
270
|
+
"MM",
|
|
271
|
+
// Myanmar
|
|
272
|
+
"PH",
|
|
273
|
+
// Philippines
|
|
274
|
+
"SG",
|
|
275
|
+
// Singapore
|
|
276
|
+
"TH",
|
|
277
|
+
// Thailand
|
|
278
|
+
"VN"
|
|
279
|
+
// Vietnam
|
|
280
|
+
];
|
|
281
|
+
var COMMONWEALTH_MEMBERS = [
|
|
282
|
+
"AG",
|
|
283
|
+
"AU",
|
|
284
|
+
"BS",
|
|
285
|
+
"BD",
|
|
286
|
+
"BB",
|
|
287
|
+
"BZ",
|
|
288
|
+
"BW",
|
|
289
|
+
"BN",
|
|
290
|
+
"CM",
|
|
291
|
+
"CA",
|
|
292
|
+
"CY",
|
|
293
|
+
"DM",
|
|
294
|
+
"SZ",
|
|
295
|
+
"FJ",
|
|
296
|
+
"GM",
|
|
297
|
+
"GH",
|
|
298
|
+
"GD",
|
|
299
|
+
"GY",
|
|
300
|
+
"IN",
|
|
301
|
+
"JM",
|
|
302
|
+
"KE",
|
|
303
|
+
"KI",
|
|
304
|
+
"LS",
|
|
305
|
+
"MW",
|
|
306
|
+
"MY",
|
|
307
|
+
"MV",
|
|
308
|
+
"MT",
|
|
309
|
+
"MU",
|
|
310
|
+
"MZ",
|
|
311
|
+
"NA",
|
|
312
|
+
"NR",
|
|
313
|
+
"NZ",
|
|
314
|
+
"NG",
|
|
315
|
+
"PK",
|
|
316
|
+
"PG",
|
|
317
|
+
"RW",
|
|
318
|
+
"KN",
|
|
319
|
+
"LC",
|
|
320
|
+
"VC",
|
|
321
|
+
"WS",
|
|
322
|
+
"SC",
|
|
323
|
+
"SL",
|
|
324
|
+
"SG",
|
|
325
|
+
"SB",
|
|
326
|
+
"ZA",
|
|
327
|
+
"LK",
|
|
328
|
+
"TZ",
|
|
329
|
+
"TG",
|
|
330
|
+
"TO",
|
|
331
|
+
"TT",
|
|
332
|
+
"TV",
|
|
333
|
+
"UG",
|
|
334
|
+
"GB",
|
|
335
|
+
"VU",
|
|
336
|
+
"ZM"
|
|
337
|
+
];
|
|
338
|
+
function getCountriesByRegion(region) {
|
|
339
|
+
return countries.filter((c) => c.region === region);
|
|
340
|
+
}
|
|
341
|
+
function getCountriesBySubregion(subregion) {
|
|
342
|
+
return countries.filter((c) => c.subregion === subregion);
|
|
343
|
+
}
|
|
344
|
+
function getEUCountries() {
|
|
345
|
+
const euSet = new Set(EU_MEMBERS);
|
|
346
|
+
return countries.filter((c) => euSet.has(c.iso2));
|
|
347
|
+
}
|
|
348
|
+
function getNATOCountries() {
|
|
349
|
+
const natoSet = new Set(NATO_MEMBERS);
|
|
350
|
+
return countries.filter((c) => natoSet.has(c.iso2));
|
|
351
|
+
}
|
|
352
|
+
function isEUMember(iso2) {
|
|
353
|
+
return EU_MEMBERS.includes(iso2.toUpperCase());
|
|
354
|
+
}
|
|
355
|
+
function isNATOMember(iso2) {
|
|
356
|
+
return NATO_MEMBERS.includes(iso2.toUpperCase());
|
|
357
|
+
}
|
|
358
|
+
function isSchengenMember(iso2) {
|
|
359
|
+
return SCHENGEN_AREA.includes(iso2.toUpperCase());
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export { ASEAN_MEMBERS, BRICS_MEMBERS, COMMONWEALTH_MEMBERS, EU_MEMBERS, G20_MEMBERS, G7_MEMBERS, NATO_MEMBERS, SCHENGEN_AREA, getCountriesByRegion, getCountriesBySubregion, getEUCountries, getNATOCountries, isEUMember, isNATOMember, isSchengenMember };
|
|
363
|
+
//# sourceMappingURL=index.js.map
|
|
364
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/regions/index.ts"],"names":[],"mappings":";;;AAgBO,IAAM,UAAA,GAAgC;AAAA,EAC3C,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA;AAAA;AACF;AAQO,IAAM,aAAA,GAAmC;AAAA,EAC9C,IAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EACA,IAA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AAE,cAAc,SAAS,CAAA;AAC1D;AAKO,SAAS,cAAA,GAAqC;AACnD,EAAA,MAAM,KAAA,GAAQ,IAAI,GAAA,CAAI,UAAU,CAAA;AAChC,EAAA,OAAO,SAAA,CAAU,OAAO,CAAC,CAAA,KAAM,MAAM,GAAA,CAAI,CAAA,CAAE,IAAI,CAAC,CAAA;AAClD;AAKO,SAAS,gBAAA,GAAuC;AACrD,EAAA,MAAM,OAAA,GAAU,IAAI,GAAA,CAAI,YAAY,CAAA;AACpC,EAAA,OAAO,SAAA,CAAU,OAAO,CAAC,CAAA,KAAM,QAAQ,GAAA,CAAI,CAAA,CAAE,IAAI,CAAC,CAAA;AACpD;AAQO,SAAS,WAAW,IAAA,EAAuB;AAChD,EAAA,OAAO,UAAA,CAAW,QAAA,CAAS,IAAA,CAAK,WAAA,EAA0C,CAAA;AAC5E;AAKO,SAAS,aAAa,IAAA,EAAuB;AAClD,EAAA,OAAO,YAAA,CAAa,QAAA,CAAS,IAAA,CAAK,WAAA,EAA4C,CAAA;AAChF;AAKO,SAAS,iBAAiB,IAAA,EAAuB;AACtD,EAAA,OAAO,aAAA,CAAc,QAAA,CAAS,IAAA,CAAK,WAAA,EAA6C,CAAA;AAClF","file":"index.js","sourcesContent":["/**\n * Region and grouping exports\n *\n * All groupings are documented with official sources.\n * Membership data is current as of 2024-01-15.\n */\n\nimport { countries } from '../data/countries.js';\nimport type { Country, Region, Subregion } from '../types/index.js';\n\n/**\n * European Union member states (ISO 3166-1 Alpha-2 codes)\n *\n * Source: https://european-union.europa.eu/principles-countries-history/country-profiles_en\n * Last updated: 2024-01-15\n */\nexport const EU_MEMBERS: readonly string[] = [\n 'AT', // Austria\n 'BE', // Belgium\n 'BG', // Bulgaria\n 'HR', // Croatia\n 'CY', // Cyprus\n 'CZ', // Czechia\n 'DK', // Denmark\n 'EE', // Estonia\n 'FI', // Finland\n 'FR', // France\n 'DE', // Germany\n 'GR', // Greece\n 'HU', // Hungary\n 'IE', // Ireland\n 'IT', // Italy\n 'LV', // Latvia\n 'LT', // Lithuania\n 'LU', // Luxembourg\n 'MT', // Malta\n 'NL', // Netherlands\n 'PL', // Poland\n 'PT', // Portugal\n 'RO', // Romania\n 'SK', // Slovakia\n 'SI', // Slovenia\n 'ES', // Spain\n 'SE', // Sweden\n] as const;\n\n/**\n * Schengen Area member states\n *\n * Source: https://home-affairs.ec.europa.eu/policies/schengen-borders-and-visa/schengen-area_en\n * Last updated: 2024-01-15\n */\nexport const SCHENGEN_AREA: readonly string[] = [\n 'AT', // Austria\n 'BE', // Belgium\n 'HR', // Croatia\n 'CZ', // Czechia\n 'DK', // Denmark\n 'EE', // Estonia\n 'FI', // Finland\n 'FR', // France\n 'DE', // Germany\n 'GR', // Greece\n 'HU', // Hungary\n 'IS', // Iceland (not EU)\n 'IT', // Italy\n 'LV', // Latvia\n 'LI', // Liechtenstein (not EU)\n 'LT', // Lithuania\n 'LU', // Luxembourg\n 'MT', // Malta\n 'NL', // Netherlands\n 'NO', // Norway (not EU)\n 'PL', // Poland\n 'PT', // Portugal\n 'SK', // Slovakia\n 'SI', // Slovenia\n 'ES', // Spain\n 'SE', // Sweden\n 'CH', // Switzerland (not EU)\n] as const;\n\n/**\n * NATO member states\n *\n * Source: https://www.nato.int/cps/en/natohq/nato_countries.htm\n * Last updated: 2024-01-15\n */\nexport const NATO_MEMBERS: readonly string[] = [\n 'AL', // Albania\n 'BE', // Belgium\n 'BG', // Bulgaria\n 'CA', // Canada\n 'HR', // Croatia\n 'CZ', // Czechia\n 'DK', // Denmark\n 'EE', // Estonia\n 'FI', // Finland\n 'FR', // France\n 'DE', // Germany\n 'GR', // Greece\n 'HU', // Hungary\n 'IS', // Iceland\n 'IT', // Italy\n 'LV', // Latvia\n 'LT', // Lithuania\n 'LU', // Luxembourg\n 'ME', // Montenegro\n 'NL', // Netherlands\n 'MK', // North Macedonia\n 'NO', // Norway\n 'PL', // Poland\n 'PT', // Portugal\n 'RO', // Romania\n 'SK', // Slovakia\n 'SI', // Slovenia\n 'ES', // Spain\n 'SE', // Sweden\n 'TR', // Türkiye\n 'GB', // United Kingdom\n 'US', // United States\n] as const;\n\n/**\n * G7 member states\n *\n * Source: https://www.g7germany.de/g7-en/g7-countries\n * Last updated: 2024-01-15\n */\nexport const G7_MEMBERS: readonly string[] = [\n 'CA', // Canada\n 'FR', // France\n 'DE', // Germany\n 'IT', // Italy\n 'JP', // Japan\n 'GB', // United Kingdom\n 'US', // United States\n] as const;\n\n/**\n * G20 member states\n *\n * Source: https://www.g20.org/en/about-the-g20\n * Last updated: 2024-01-15\n */\nexport const G20_MEMBERS: readonly string[] = [\n 'AR', // Argentina\n 'AU', // Australia\n 'BR', // Brazil\n 'CA', // Canada\n 'CN', // China\n 'FR', // France\n 'DE', // Germany\n 'IN', // India\n 'ID', // Indonesia\n 'IT', // Italy\n 'JP', // Japan\n 'MX', // Mexico\n 'RU', // Russia\n 'SA', // Saudi Arabia\n 'ZA', // South Africa\n 'KR', // South Korea\n 'TR', // Türkiye\n 'GB', // United Kingdom\n 'US', // United States\n // EU is also a member but represented by code, not included here as it's not a country\n] as const;\n\n/**\n * BRICS member states\n *\n * Source: https://www.brics2024.gov.ru/en/\n * Last updated: 2024-01-15 (includes 2024 expansion)\n */\nexport const BRICS_MEMBERS: readonly string[] = [\n 'BR', // Brazil\n 'RU', // Russia\n 'IN', // India\n 'CN', // China\n 'ZA', // South Africa\n 'EG', // Egypt (2024)\n 'ET', // Ethiopia (2024)\n 'IR', // Iran (2024)\n 'AE', // United Arab Emirates (2024)\n] as const;\n\n/**\n * ASEAN member states\n *\n * Source: https://asean.org/member-states/\n * Last updated: 2024-01-15\n */\nexport const ASEAN_MEMBERS: readonly string[] = [\n 'BN', // Brunei\n 'KH', // Cambodia\n 'ID', // Indonesia\n 'LA', // Laos\n 'MY', // Malaysia\n 'MM', // Myanmar\n 'PH', // Philippines\n 'SG', // Singapore\n 'TH', // Thailand\n 'VN', // Vietnam\n] as const;\n\n/**\n * Commonwealth of Nations members\n *\n * Source: https://thecommonwealth.org/member-countries\n * Last updated: 2024-01-15\n */\nexport const COMMONWEALTH_MEMBERS: readonly string[] = [\n 'AG', 'AU', 'BS', 'BD', 'BB', 'BZ', 'BW', 'BN', 'CM', 'CA',\n 'CY', 'DM', 'SZ', 'FJ', 'GM', 'GH', 'GD', 'GY', 'IN', 'JM',\n 'KE', 'KI', 'LS', 'MW', 'MY', 'MV', 'MT', 'MU', 'MZ', 'NA',\n 'NR', 'NZ', 'NG', 'PK', 'PG', 'RW', 'KN', 'LC', 'VC', 'WS',\n 'SC', 'SL', 'SG', 'SB', 'ZA', 'LK', 'TZ', 'TG', 'TO', 'TT',\n 'TV', 'UG', 'GB', 'VU', 'ZM',\n] as const;\n\n// ============================================================================\n// Helper functions for region filtering\n// ============================================================================\n\n/**\n * Get all countries in a specific region\n *\n * @param region - UN M49 region\n * @returns Array of countries in the region\n *\n * @example\n * ```ts\n * import { getCountriesByRegion } from '@countries/core/regions';\n *\n * const europeanCountries = getCountriesByRegion('Europe');\n * ```\n */\nexport function getCountriesByRegion(region: Region): readonly Country[] {\n return countries.filter((c) => c.region === region);\n}\n\n/**\n * Get all countries in a specific subregion\n *\n * @param subregion - UN M49 subregion\n * @returns Array of countries in the subregion\n *\n * @example\n * ```ts\n * import { getCountriesBySubregion } from '@countries/core/regions';\n *\n * const westernEurope = getCountriesBySubregion('Western Europe');\n * ```\n */\nexport function getCountriesBySubregion(subregion: Subregion): readonly Country[] {\n return countries.filter((c) => c.subregion === subregion);\n}\n\n/**\n * Get EU member country objects\n */\nexport function getEUCountries(): readonly Country[] {\n const euSet = new Set(EU_MEMBERS);\n return countries.filter((c) => euSet.has(c.iso2));\n}\n\n/**\n * Get NATO member country objects\n */\nexport function getNATOCountries(): readonly Country[] {\n const natoSet = new Set(NATO_MEMBERS);\n return countries.filter((c) => natoSet.has(c.iso2));\n}\n\n/**\n * Check if a country is an EU member\n *\n * @param iso2 - ISO 3166-1 Alpha-2 code\n * @returns true if country is an EU member\n */\nexport function isEUMember(iso2: string): boolean {\n return EU_MEMBERS.includes(iso2.toUpperCase() as typeof EU_MEMBERS[number]);\n}\n\n/**\n * Check if a country is a NATO member\n */\nexport function isNATOMember(iso2: string): boolean {\n return NATO_MEMBERS.includes(iso2.toUpperCase() as typeof NATO_MEMBERS[number]);\n}\n\n/**\n * Check if a country is in the Schengen Area\n */\nexport function isSchengenMember(iso2: string): boolean {\n return SCHENGEN_AREA.includes(iso2.toUpperCase() as typeof SCHENGEN_AREA[number]);\n}\n\n"]}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @countries/core - Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Data Sources:
|
|
5
|
+
* - ISO 3166-1 (country codes): https://www.iso.org/iso-3166-country-codes.html
|
|
6
|
+
* - UN M49 (regions): https://unstats.un.org/unsd/methodology/m49/
|
|
7
|
+
* - IANA (ccTLDs): https://www.iana.org/domains/root/db
|
|
8
|
+
*
|
|
9
|
+
* Last Updated: 2024-01-15
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* UN M49 Region classification
|
|
13
|
+
* @see https://unstats.un.org/unsd/methodology/m49/
|
|
14
|
+
*/
|
|
15
|
+
type Region = 'Africa' | 'Americas' | 'Asia' | 'Europe' | 'Oceania' | 'Antarctica';
|
|
16
|
+
/**
|
|
17
|
+
* UN M49 Subregion classification
|
|
18
|
+
* @see https://unstats.un.org/unsd/methodology/m49/
|
|
19
|
+
*/
|
|
20
|
+
type Subregion = 'Northern Africa' | 'Eastern Africa' | 'Middle Africa' | 'Southern Africa' | 'Western Africa' | 'Caribbean' | 'Central America' | 'South America' | 'Northern America' | 'Central Asia' | 'Eastern Asia' | 'South-Eastern Asia' | 'Southern Asia' | 'Western Asia' | 'Eastern Europe' | 'Northern Europe' | 'Southern Europe' | 'Western Europe' | 'Australia and New Zealand' | 'Melanesia' | 'Micronesia' | 'Polynesia' | 'Antarctica';
|
|
21
|
+
/**
|
|
22
|
+
* ISO 3166-1 Alpha-2 country code (2 letters)
|
|
23
|
+
* @example "US", "GB", "DE"
|
|
24
|
+
*/
|
|
25
|
+
type ISO2 = string;
|
|
26
|
+
/**
|
|
27
|
+
* ISO 3166-1 Alpha-3 country code (3 letters)
|
|
28
|
+
* @example "USA", "GBR", "DEU"
|
|
29
|
+
*/
|
|
30
|
+
type ISO3 = string;
|
|
31
|
+
/**
|
|
32
|
+
* ISO 3166-1 Numeric country code (3 digits as string)
|
|
33
|
+
* @example "840", "826", "276"
|
|
34
|
+
*/
|
|
35
|
+
type ISONumeric = string;
|
|
36
|
+
/**
|
|
37
|
+
* Canonical Country object - the single source of truth
|
|
38
|
+
*
|
|
39
|
+
* All provider mappings derive from this model.
|
|
40
|
+
* This is an immutable, read-only structure.
|
|
41
|
+
*/
|
|
42
|
+
interface Country {
|
|
43
|
+
/**
|
|
44
|
+
* ISO 3166-1 Alpha-2 code (2 letters, uppercase)
|
|
45
|
+
* @example "US"
|
|
46
|
+
*/
|
|
47
|
+
readonly iso2: ISO2;
|
|
48
|
+
/**
|
|
49
|
+
* ISO 3166-1 Alpha-3 code (3 letters, uppercase)
|
|
50
|
+
* @example "USA"
|
|
51
|
+
*/
|
|
52
|
+
readonly iso3: ISO3;
|
|
53
|
+
/**
|
|
54
|
+
* ISO 3166-1 Numeric code (3 digits, zero-padded string)
|
|
55
|
+
* @example "840"
|
|
56
|
+
*/
|
|
57
|
+
readonly isoNumeric: ISONumeric;
|
|
58
|
+
/**
|
|
59
|
+
* Official country name (English)
|
|
60
|
+
* @example "United States of America"
|
|
61
|
+
*/
|
|
62
|
+
readonly name: string;
|
|
63
|
+
/**
|
|
64
|
+
* UN M49 Region
|
|
65
|
+
* @example "Americas"
|
|
66
|
+
*/
|
|
67
|
+
readonly region: Region;
|
|
68
|
+
/**
|
|
69
|
+
* UN M49 Subregion
|
|
70
|
+
* @example "Northern America"
|
|
71
|
+
*/
|
|
72
|
+
readonly subregion: Subregion;
|
|
73
|
+
/**
|
|
74
|
+
* Country code Top-Level Domains (ccTLDs)
|
|
75
|
+
* Array because some countries have multiple (e.g., UK has .uk and .gb)
|
|
76
|
+
* @example [".us"]
|
|
77
|
+
*/
|
|
78
|
+
readonly tld: readonly string[];
|
|
79
|
+
/**
|
|
80
|
+
* Primary calling code (ITU E.164)
|
|
81
|
+
* Includes the "+" prefix
|
|
82
|
+
* @example "+1"
|
|
83
|
+
*/
|
|
84
|
+
readonly callingCode: string;
|
|
85
|
+
/**
|
|
86
|
+
* Whether this is an independent sovereign state
|
|
87
|
+
* Some ISO codes are for territories, dependencies, etc.
|
|
88
|
+
*/
|
|
89
|
+
readonly independent: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* UN Member status
|
|
92
|
+
*/
|
|
93
|
+
readonly unMember: boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Readonly array of countries
|
|
97
|
+
*/
|
|
98
|
+
type CountryList = readonly Country[];
|
|
99
|
+
/**
|
|
100
|
+
* Lookup result - may be undefined if not found
|
|
101
|
+
*/
|
|
102
|
+
type CountryLookupResult = Country | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Search options for country queries
|
|
105
|
+
*/
|
|
106
|
+
interface SearchOptions {
|
|
107
|
+
/**
|
|
108
|
+
* Case-insensitive search (default: true)
|
|
109
|
+
*/
|
|
110
|
+
readonly caseInsensitive?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Match from start of string only (default: false)
|
|
113
|
+
*/
|
|
114
|
+
readonly startsWith?: boolean;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export type { Country, CountryList, CountryLookupResult, ISO2, ISO3, ISONumeric, Region, SearchOptions, Subregion };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@martince/countries",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Canonical country data - ISO 3166-1 codes, names, regions, and domains",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./countries": {
|
|
13
|
+
"types": "./dist/countries/index.d.ts",
|
|
14
|
+
"import": "./dist/countries/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./countries/*": {
|
|
17
|
+
"types": "./dist/countries/*.d.ts",
|
|
18
|
+
"import": "./dist/countries/*.js"
|
|
19
|
+
},
|
|
20
|
+
"./regions": {
|
|
21
|
+
"types": "./dist/regions/index.d.ts",
|
|
22
|
+
"import": "./dist/regions/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./types": {
|
|
25
|
+
"types": "./dist/types/index.d.ts",
|
|
26
|
+
"import": "./dist/types/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"main": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup",
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"clean": "rm -rf dist"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"countries",
|
|
43
|
+
"iso-3166",
|
|
44
|
+
"country-codes",
|
|
45
|
+
"iso2",
|
|
46
|
+
"iso3",
|
|
47
|
+
"regions",
|
|
48
|
+
"tree-shakable"
|
|
49
|
+
],
|
|
50
|
+
"author": "",
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "https://github.com/your-org/countries.git",
|
|
55
|
+
"directory": "packages/core"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"tsup": "^8.0.1",
|
|
59
|
+
"typescript": "^5.3.3"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
|
+
}
|
|
64
|
+
}
|