Last active
October 16, 2024 10:27
-
-
Save KingDarBoja/cf664cc395c4d95e645fd1f720c13746 to your computer and use it in GitHub Desktop.
TypeScript enum Country Codes ISO 3166 Alpha 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Countries Enumerables based on [ISO 3166-1 Alpha2 | |
* Code](https://www.iso.org/iso-3166-country-codes.html). These enumerables | |
* were converted into alpha3 codes based on https://www.iban.com/country-codes. | |
*/ | |
export enum CountriesEnum { | |
AFG = 'Afghanistan', | |
ALA = 'Aland Islands', | |
ALB = 'Albania', | |
DZA = 'Algeria', | |
ASM = 'American Samoa', | |
AND = 'Andorra', | |
AGO = 'Angola', | |
AIA = 'Anguilla', | |
ATA = 'Antarctica', | |
ATG = 'Antigua and Barbuda', | |
ARG = 'Argentina', | |
ARM = 'Armenia', | |
ABW = 'Aruba', | |
AUS = 'Australia', | |
AUT = 'Austria', | |
AZE = 'Azerbaijan', | |
BHS = 'Bahamas', | |
BHR = 'Bahrain', | |
BGD = 'Bangladesh', | |
BRB = 'Barbados', | |
BLR = 'Belarus', | |
BEL = 'Belgium', | |
BLZ = 'Belize', | |
BEN = 'Benin', | |
BMU = 'Bermuda', | |
BTN = 'Bhutan', | |
BOL = 'Bolivia', | |
BIH = 'Bosnia and Herzegovina', | |
BWA = 'Botswana', | |
BVT = 'Bouvet Island', | |
BRA = 'Brazil', | |
IOT = 'British Indian Ocean Territory', | |
BRN = 'Brunei Darussalam', | |
BGR = 'Bulgaria', | |
BFA = 'Burkina Faso', | |
BDI = 'Burundi', | |
KHM = 'Cambodia', | |
CMR = 'Cameroon', | |
CAN = 'Canada', | |
CPV = 'Cape Verde', | |
CYM = 'Cayman Islands', | |
CAF = 'Central African Republic', | |
TCD = 'Chad', | |
CHL = 'Chile', | |
CHN = 'China', | |
CXR = 'Christmas Island', | |
CCK = 'Cocos Keeling Islands', | |
COL = 'Colombia', | |
COM = 'Comoros', | |
COG = 'Congo', | |
COD = 'Congo Democratic Republic', | |
COK = 'Cook Islands', | |
CRI = 'Costa Rica', | |
CIV = 'Cote D\'Ivoire', | |
HRV = 'Croatia', | |
CUB = 'Cuba', | |
CYP = 'Cyprus', | |
CZE = 'CzechRepublic', | |
DNK = 'Denmark', | |
DJI = 'Djibouti', | |
DMA = 'Dominica', | |
DOM = 'Dominican Republic', | |
ECU = 'Ecuador', | |
EGY = 'Egypt', | |
SLV = 'El Salvador', | |
GNQ = 'Equatorial Guinea', | |
ERI = 'Eritrea', | |
EST = 'Estonia', | |
ETH = 'Ethiopia', | |
FLK = 'Falkland Islands', | |
FRO = 'Faroe Islands', | |
FJI = 'Fiji', | |
FIN = 'Finland', | |
FRA = 'France', | |
GUF = 'French Guiana', | |
PYF = 'French Polynesia', | |
ATF = 'French Southern Territories', | |
GAB = 'Gabon', | |
GMB = 'Gambia', | |
GEO = 'Georgia', | |
DEU = 'Germany', | |
GHA = 'Ghana', | |
GIB = 'Gibraltar', | |
GRC = 'Greece', | |
GRL = 'Greenland', | |
GRD = 'Grenada', | |
GLP = 'Guadeloupe', | |
GUM = 'Guam', | |
GTM = 'Guatemala', | |
GGY = 'Guernsey', | |
GIN = 'Guinea', | |
GNB = 'Guinea Bissau', | |
GUY = 'Guyana', | |
HTI = 'Haiti', | |
HMD = 'Heard Island Mcdonald Islands', | |
VAT = 'Holy See Vatican City State', | |
HND = 'Honduras', | |
HKG = 'HongKong', | |
HUN = 'Hungary', | |
ISL = 'Iceland', | |
IND = 'India', | |
IDN = 'Indonesia', | |
IRN = 'Iran', | |
IRQ = 'Iraq', | |
IRL = 'Ireland', | |
IMN = 'Isle Of Man', | |
ISR = 'Israel', | |
ITA = 'Italy', | |
JAM = 'Jamaica', | |
JPN = 'Japan', | |
JEY = 'Jersey', | |
JOR = 'Jordan', | |
KAZ = 'Kazakhstan', | |
KEN = 'Kenya', | |
KIR = 'Kiribati', | |
KOR = 'Korea, Republic of', | |
PRK = 'Korea, Democratic People\'s Republic of', | |
KWT = 'Kuwait', | |
KGZ = 'Kyrgyzstan', | |
LAO = 'Lao Peoples Democratic Republic', | |
LVA = 'Latvia', | |
LBN = 'Lebanon', | |
LSO = 'Lesotho', | |
LBR = 'Liberia', | |
LBY = 'Libyan Arab Jamahiriya', | |
LIE = 'Liechtenstein', | |
LTU = 'Lithuania', | |
LUX = 'Luxembourg', | |
MAC = 'Macao', | |
MDG = 'Madagascar', | |
MWI = 'Malawi', | |
MYS = 'Malaysia', | |
MDV = 'Maldives', | |
MLI = 'Mali', | |
MLT = 'Malta', | |
MHL = 'Marshall Islands', | |
MTQ = 'Martinique', | |
MRT = 'Mauritania', | |
MUS = 'Mauritius', | |
MYT = 'Mayotte', | |
MEX = 'Mexico', | |
FSM = 'Micronesia', | |
MDA = 'Moldova', | |
MCO = 'Monaco', | |
MNG = 'Mongolia', | |
MNE = 'Montenegro', | |
MSR = 'Montserrat', | |
MAR = 'Morocco', | |
MOZ = 'Mozambique', | |
MMR = 'Myanmar', | |
NAM = 'Namibia', | |
NRU = 'Nauru', | |
NPL = 'Nepal', | |
NLD = 'Netherlands', | |
NCL = 'New Caledonia', | |
NZL = 'New Zealand', | |
NIC = 'Nicaragua', | |
NER = 'Niger', | |
NGA = 'Nigeria', | |
NIU = 'Niue', | |
NFK = 'Norfolk Island', | |
MNP = 'Northern Mariana Islands', | |
NOR = 'Norway', | |
OMN = 'Oman', | |
PAK = 'Pakistan', | |
PLW = 'Palau', | |
PSE = 'Palestinian Territory', | |
PAN = 'Panama', | |
PNG = 'Papua New Guinea', | |
PRY = 'Paraguay', | |
PER = 'Peru', | |
PHL = 'Philippines', | |
PCN = 'Pitcairn', | |
POL = 'Poland', | |
PRT = 'Portugal', | |
PRI = 'Puerto Rico', | |
QAT = 'Qatar', | |
MKD = 'Republic of North Macedonia', | |
REU = 'Réunion', | |
ROU = 'Romania', | |
RUS = 'Russian Federation', | |
RWA = 'Rwanda', | |
BLM = 'Saint Barthelemy', | |
SHN = 'Saint Helena', | |
KNA = 'Saint Kitts And Nevis', | |
LCA = 'Saint Lucia', | |
MAF = 'Saint Martin', | |
SPM = 'Saint Pierre And Miquelon', | |
VCT = 'Saint Vincent And Grenadines', | |
WSM = 'Samoa', | |
SMR = 'San Marino', | |
STP = 'Sao Tome And Principe', | |
SAU = 'Saudi Arabia', | |
SEN = 'Senegal', | |
SRB = 'Serbia', | |
SYC = 'Seychelles', | |
SLE = 'Sierra Leone', | |
SGP = 'Singapore', | |
SXM = 'Sint Maarten (Dutch part)', | |
SVK = 'Slovakia', | |
SVN = 'Slovenia', | |
SLB = 'Solomon Islands', | |
SOM = 'Somalia', | |
ZAF = 'South Africa', | |
SGS = 'South Georgia And Sandwich Island', | |
SSD = 'South Sudan', | |
ESP = 'Spain', | |
LKA = 'Sri Lanka', | |
SDN = 'Sudan', | |
SUR = 'Suriname', | |
SJM = 'Svalbard And Jan Mayen', | |
SWZ = 'Swaziland', | |
SWE = 'Sweden', | |
CHE = 'Switzerland', | |
SYR = 'Syrian Arab Republic', | |
TWN = 'Taiwan', | |
TJK = 'Tajikistan', | |
TZA = 'Tanzania', | |
THA = 'Thailand', | |
TLS = 'Timor-Leste', | |
TGO = 'Togo', | |
TKL = 'Tokelau', | |
TON = 'Tonga', | |
TTO = 'Trinidad And Tobago', | |
TUN = 'Tunisia', | |
TUR = 'Turkey', | |
TKM = 'Turkmenistan', | |
TCA = 'Turks And Caicos Islands', | |
TUV = 'Tuvalu', | |
UGA = 'Uganda', | |
UKR = 'Ukraine', | |
ARE = 'United Arab Emirates', | |
GBR = 'United Kingdom', | |
UMI = 'United States Outlying Islands', | |
USA = 'United States', | |
URY = 'Uruguay', | |
UZB = 'Uzbekistan', | |
VUT = 'Vanuatu', | |
VEN = 'Venezuela', | |
VNM = 'Vietnam', | |
VGB = 'Virgin Islands British', | |
VIR = 'Virgin Islands US', | |
WLF = 'Wallis And Futuna', | |
ESH = 'Western Sahara', | |
YEM = 'Yemen', | |
ZMB = 'Zambia', | |
ZWE = 'Zimbabwe' | |
} |
Oh this is useful!
Is there a reverse anywhere? With the values being the Alpha 3 code?
Might be a simple regex replace to do it but I'm not super skilled at regex for that
Well, you learn something new every day! Here's the other order
export enum CountriesEnum {
Afghanistan = 'AFG',
'Aland Islands' = 'ALA',
Albania = 'ALB',
Algeria = 'DZA',
'American Samoa' = 'ASM',
Andorra = 'AND',
Angola = 'AGO',
Anguilla = 'AIA',
Antarctica = 'ATA',
'Antigua and Barbuda' = 'ATG',
Argentina = 'ARG',
Armenia = 'ARM',
Aruba = 'ABW',
Australia = 'AUS',
Austria = 'AUT',
Azerbaijan = 'AZE',
Bahamas = 'BHS',
Bahrain = 'BHR',
Bangladesh = 'BGD',
Barbados = 'BRB',
Belarus = 'BLR',
Belgium = 'BEL',
Belize = 'BLZ',
Benin = 'BEN',
Bermuda = 'BMU',
Bhutan = 'BTN',
Bolivia = 'BOL',
'Bosnia and Herzegovina' = 'BIH',
Botswana = 'BWA',
'Bouvet Island' = 'BVT',
Brazil = 'BRA',
'British Indian Ocean Territory' = 'IOT',
'Brunei Darussalam' = 'BRN',
Bulgaria = 'BGR',
'Burkina Faso' = 'BFA',
Burundi = 'BDI',
Cambodia = 'KHM',
Cameroon = 'CMR',
Canada = 'CAN',
'Cape Verde' = 'CPV',
'Cayman Islands' = 'CYM',
'Central African Republic' = 'CAF',
Chad = 'TCD',
Chile = 'CHL',
China = 'CHN',
'Christmas Island' = 'CXR',
'Cocos Keeling Islands' = 'CCK',
Colombia = 'COL',
Comoros = 'COM',
'Congo' = 'COG',
'Congo Democratic Republic' = 'COD',
'Cook Islands' = 'COK',
'Costa Rica' = 'CRI',
'Cote D\'Ivoire' = 'CIV',
Croatia = 'HRV',
Cuba = 'CUB',
Cyprus = 'CYP',
CzechRepublic = 'CZE',
Denmark = 'DNK',
Djibouti = 'DJI',
Dominica = 'DMA',
'Dominican Republic' = 'DOM',
Ecuador = 'ECU',
Egypt = 'EGY',
'El Salvador' = 'SLV',
'Equatorial Guinea' = 'GNQ',
Eritrea = 'ERI',
Estonia = 'EST',
Ethiopia = 'ETH',
'Falkland Islands' = 'FLK',
'Faroe Islands' = 'FRO',
Fiji = 'FJI',
Finland = 'FIN',
France = 'FRA',
'French Guiana' = 'GUF',
'French Polynesia' = 'PYF',
'French Southern Territories' = 'ATF',
Gabon = 'GAB',
Gambia = 'GMB',
Georgia = 'GEO',
Germany = 'DEU',
Ghana = 'GHA',
Gibraltar = 'GIB',
Greece = 'GRC',
Greenland = 'GRL',
Grenada = 'GRD',
Guadeloupe = 'GLP',
Guam = 'GUM',
Guatemala = 'GTM',
Guernsey = 'GGY',
Guinea = 'GIN',
'Guinea Bissau' = 'GNB',
Guyana = 'GUY',
Haiti = 'HTI',
'Heard Island Mcdonald Islands' = 'HMD',
'Holy See Vatican City State' = 'VAT',
Honduras = 'HND',
HongKong = 'HKG',
Hungary = 'HUN',
Iceland = 'ISL',
India = 'IND',
Indonesia = 'IDN',
Iran = 'IRN',
Iraq = 'IRQ',
Ireland = 'IRL',
'Isle Of Man' = 'IMN',
Israel = 'ISR',
Italy = 'ITA',
Jamaica = 'JAM',
Japan = 'JPN',
Jersey = 'JEY',
Jordan = 'JOR',
Kazakhstan = 'KAZ',
Kenya = 'KEN',
Kiribati = 'KIR',
'Korea, Republic of' = 'KOR',
'Korea, Democratic People\'s Republic of' = 'PRK',
Kuwait = 'KWT',
Kyrgyzstan = 'KGZ',
'Lao Peoples Democratic Republic' = 'LAO',
Latvia = 'LVA',
Lebanon = 'LBN',
Lesotho = 'LSO',
Liberia = 'LBR',
'Libyan Arab Jamahiriya' = 'LBY',
Liechtenstein = 'LIE',
Lithuania = 'LTU',
Luxembourg = 'LUX',
Macao = 'MAC',
Madagascar = 'MDG',
Malawi = 'MWI',
Malaysia = 'MYS',
Maldives = 'MDV',
Mali = 'MLI',
Malta = 'MLT',
'Marshall Islands' = 'MHL',
Martinique = 'MTQ',
Mauritania = 'MRT',
Mauritius = 'MUS',
Mayotte = 'MYT',
Mexico = 'MEX',
Micronesia = 'FSM',
Moldova = 'MDA',
Monaco = 'MCO',
Mongolia = 'MNG',
Montenegro = 'MNE',
Montserrat = 'MSR',
Morocco = 'MAR',
Mozambique = 'MOZ',
Myanmar = 'MMR',
Namibia = 'NAM',
Nauru = 'NRU',
Nepal = 'NPL',
Netherlands = 'NLD',
'New Caledonia' = 'NCL',
'New Zealand' = 'NZL',
Nicaragua = 'NIC',
Niger = 'NER',
Nigeria = 'NGA',
Niue = 'NIU',
'Norfolk Island' = 'NFK',
'Northern Mariana Islands' = 'MNP',
Norway = 'NOR',
Oman = 'OMN',
Pakistan = 'PAK',
Palau = 'PLW',
'Palestinian Territory' = 'PSE',
Panama = 'PAN',
'Papua New Guinea' = 'PNG',
Paraguay = 'PRY',
Peru = 'PER',
Philippines = 'PHL',
Pitcairn = 'PCN',
Poland = 'POL',
Portugal = 'PRT',
'Puerto Rico' = 'PRI',
Qatar = 'QAT',
'Republic of North Macedonia' = 'MKD',
'Réunion' = 'REU',
Romania = 'ROU',
'Russian Federation' = 'RUS',
Rwanda = 'RWA',
'Saint Barthelemy' = 'BLM',
'Saint Helena' = 'SHN',
'Saint Kitts And Nevis' = 'KNA',
'Saint Lucia' = 'LCA',
'Saint Martin' = 'MAF',
'Saint Pierre And Miquelon' = 'SPM',
'Saint Vincent And Grenadines' = 'VCT',
Samoa = 'WSM',
'San Marino' = 'SMR',
'Sao Tome And Principe' = 'STP',
'Saudi Arabia' = 'SAU',
Senegal = 'SEN',
Serbia = 'SRB',
Seychelles = 'SYC',
'Sierra Leone' = 'SLE',
Singapore = 'SGP',
'Sint Maarten (Dutch part)' = 'SXM',
Slovakia = 'SVK',
Slovenia = 'SVN',
'Solomon Islands' = 'SLB',
Somalia = 'SOM',
'South Africa' = 'ZAF',
'South Georgia And Sandwich Island' = 'SGS',
'South Sudan' = 'SSD',
Spain = 'ESP',
'Sri Lanka' = 'LKA',
Sudan = 'SDN',
Suriname = 'SUR',
'Svalbard And Jan Mayen' = 'SJM',
Swaziland = 'SWZ',
Sweden = 'SWE',
Switzerland = 'CHE',
'Syrian Arab Republic' = 'SYR',
Taiwan = 'TWN',
Tajikistan = 'TJK',
Tanzania = 'TZA',
Thailand = 'THA',
'Timor-Leste' = 'TLS',
Togo = 'TGO',
Tokelau = 'TKL',
Tonga = 'TON',
'Trinidad And Tobago' = 'TTO',
Tunisia = 'TUN',
Turkey = 'TUR',
Turkmenistan = 'TKM',
'Turks And Caicos Islands' = 'TCA',
Tuvalu = 'TUV',
Uganda = 'UGA',
Ukraine = 'UKR',
'United Arab Emirates' = 'ARE',
'United Kingdom' = 'GBR',
'United States Outlying Islands' = 'UMI',
'United States' = 'USA',
Uruguay = 'URY',
Uzbekistan = 'UZB',
Vanuatu = 'VUT',
Venezuela = 'VEN',
Vietnam = 'VNM',
'Virgin Islands British' = 'VGB',
'Virgin Islands US' = 'VIR',
'Wallis And Futuna' = 'WLF',
'Western Sahara' = 'ESH',
Yemen = 'YEM',
Zambia = 'ZMB',
'Zimbabwe' = 'ZWE'
}
The last one is Inversed...
ZWE = 'Zimbabwe' -> Zimbabwe = 'ZWE'
My bad there. Only realised that a a while ago but forgot about this gist haha
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Corrected some ISO codes: