Created
May 25, 2019 18:27
-
-
Save gusblacknails/30c5d7e08ccfdf18cfd940d2096d63e5 to your computer and use it in GitHub Desktop.
Conversión de código de país ISO a nombre de país en JavaScript
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
const isoCountries = { | |
AF: "Afganistán", | |
AX: "Islas Aland", | |
AL: "Albania", | |
DZ: "Algeria", | |
AS: "Samoa Americana", | |
AD: "Andorra", | |
AO: "Angola", | |
AI: "Anguila", | |
AQ: "Antártida", | |
AG: "Antigua y Barbuda", | |
AR: "Argentina", | |
AM: "Armenia", | |
AW: "Aruba", | |
AU: "Australia", | |
AT: "Austria", | |
AZ: "Azerbaiyán", | |
BS: "Bahamas", | |
BH: "Baréin", | |
BD: "Bangladesh", | |
BB: "Barbados", | |
BY: "Bielorrusia", | |
BE: "Bélgica", | |
BZ: "Belice", | |
BJ: "Benín", | |
BM: "Bermudas", | |
BT: "Bután", | |
BO: "Bolivia", | |
BA: "Bosnia Herzegovina", | |
BW: "Botswana", | |
BV: "Isla Bouvet", | |
BR: "Brasil", | |
IO: "Territorio Británico del Océano Índico", | |
BN: "Brunéi", | |
BG: "Bulgaria", | |
BF: "Burkina Faso", | |
BI: "Burundi", | |
KH: "Camboya", | |
CM: "Camerún", | |
CA: "Canadá", | |
CV: "Cabo Verde", | |
KY: "Islas Cayman", | |
CF: "Republica Centroafricana", | |
TD: "Chad", | |
CL: "Chile", | |
CN: "China", | |
CX: "Kiritimati", | |
CC: "Islas Cocos", | |
CO: "Colombia", | |
KM: "Comoros", | |
CG: "Congo", | |
CD: "Republica Democratica del Congo", | |
CK: "Islas Cook", | |
CR: "Costa Rica", | |
CI: "Costa de Marfil", | |
HR: "Croacia", | |
CU: "Cuba", | |
CY: "Chipre", | |
CZ: "República Checa", | |
DK: "Dinamarca", | |
DJ: "Yibuti", | |
DM: "Dominica", | |
DO: "República Dominicana", | |
EC: "Ecuador", | |
EG: "Egipto", | |
SV: "El Salvador", | |
GQ: "Guinea Equatorial", | |
ER: "Eritrea", | |
EE: "Estonia", | |
ET: "Etiopía", | |
FK: "Islas Malvinas", | |
FO: "Islas Feroe", | |
FJ: "Fiyi", | |
FI: "Finlandia", | |
FR: "Francia", | |
GF: "Guayana Francesa", | |
PF: "Polinesia Francesa", | |
TF: "Territorios Franceses del sur", | |
GA: "Gabón", | |
GM: "Gambia", | |
GE: "Georgia", | |
DE: "Alemania", | |
GH: "Ghana", | |
GI: "Gibraltar", | |
GR: "Grecia", | |
GL: "Greenland", | |
GD: "Granada", | |
GP: "Guadalupe", | |
GU: "Guam", | |
GT: "Guatemala", | |
GG: "Guernsey", | |
GN: "Guinea", | |
GW: "Guinea-Bissau", | |
GY: "Guyana", | |
HT: "Haití", | |
HM: "Isla Heard e Islas Mcdonald", | |
VA: "Ciudad del Vaticano", | |
HN: "Honduras", | |
HK: "Hong Kong", | |
HU: "Hungría", | |
IS: "Islandia", | |
IN: "India", | |
ID: "Indonesia", | |
IR: "Irán", | |
IQ: "Iraq", | |
IE: "Irlanda", | |
IM: "Isla de Man", | |
IL: "Israel", | |
IT: "Italia", | |
JM: "Jamaica", | |
JP: "Japón", | |
JE: "Jersey", | |
JO: "Jordania", | |
KZ: "Kazajistán", | |
KE: "Kenia", | |
KI: "Kiribati", | |
KR: "Korea", | |
KW: "Kuwait", | |
KG: "Kirguistán", | |
LA: "Laos", | |
LV: "Letonia", | |
LB: "Líbano", | |
LS: "Lesoto", | |
LR: "Liberia", | |
LY: "Libia", | |
LI: "Liechtenstein", | |
LT: "Lituania", | |
LU: "Luxemburgo", | |
MO: "Macao", | |
MK: "Macedonia", | |
MG: "Madagascar", | |
MW: "Malaui", | |
MY: "Malasia", | |
MV: "Maldivas", | |
ML: "Mali", | |
MT: "Malta", | |
MH: "Islas Marshall", | |
MQ: "Martinica", | |
MR: "Mauritania", | |
MU: "Mauricio", | |
YT: "Mayotte", | |
MX: "México", | |
FM: "Micronesia", | |
MD: "Moldavia", | |
MC: "Mónaco", | |
MN: "Mongolia", | |
ME: "Montenegro", | |
MS: "Montserrat", | |
MA: "Marruecos", | |
MZ: "Mozambique", | |
MM: "Myanmar (Birmania)", | |
NA: "Namibia", | |
NR: "Nauru", | |
NP: "Nepal", | |
NL: "Holanda", | |
AN: "Antillas Holandesas", | |
NC: "Nueva Caledonia", | |
NZ: "Nueva Zelanda", | |
NI: "Nicaragua", | |
NE: "Níger", | |
NG: "Nigeria", | |
NU: "Niue", | |
NF: "Isla Norfolk", | |
MP: "Islas Marianas del Norte", | |
NO: "Noruega", | |
OM: "Omán", | |
PK: "Pakistán", | |
PW: "Palau", | |
PS: "Palestina", | |
PA: "Panamá", | |
PG: "Papua Nueva Guinea", | |
PY: "Paraguay", | |
PE: "Perú", | |
PH: "Filipinas", | |
PN: "Islas Pitcairn", | |
PL: "Polonia", | |
PT: "Portugal", | |
PR: "Puerto Rico", | |
QA: "Qatar", | |
RE: "Reunión", | |
RO: "Rumanía", | |
RU: "Rusia", | |
RW: "Ruanda", | |
BL: "San Bartolomé", | |
SH: "Santa Helena", | |
KN: "San Cristóbal y Nieves", | |
LC: "Santa Lucía", | |
MF: "San Martín", | |
PM: "San Pedro y Miquelón", | |
VC: "San Vicente y las Granadinas", | |
WS: "Samoa", | |
SM: "San Marino", | |
ST: "Santo Tomé y Príncipe", | |
SA: "Arabia Saudita", | |
SN: "Senegal", | |
RS: "Serbia", | |
SC: "Seychelles", | |
SL: "Sierra Leona", | |
SG: "Singapur", | |
SK: "Eslovaquia", | |
SI: "Eslovenia", | |
SB: "Islas Salomón", | |
SO: "Somalia", | |
ZA: "Sur África", | |
GS: "Islas Georgias del Sur y Sandwich del Sur", | |
ES: "España", | |
LK: "Sri Lanka", | |
SD: "Sudán", | |
SR: "Surinam", | |
SJ: "Svalbard y Jan Mayen", | |
SZ: "Esuatini", | |
SE: "Suecia", | |
CH: "Suiza", | |
SY: "Siria", | |
TW: "Taiwán", | |
TJ: "Tayikistán", | |
TZ: "Tanzania", | |
TH: "Tailandia", | |
TL: "Timor Oriental", | |
TG: "Togo", | |
TK: "Tokelau", | |
TO: "Tonga", | |
TT: "Trinidad y Tobago", | |
TN: "Túnez", | |
TR: "Turquia", | |
TM: "Turkmenistán", | |
TC: "Islas Turcas y Caicos", | |
TV: "Tuvalu", | |
UG: "Uganda", | |
UA: "Ucraina", | |
AE: "Emiratos Árabes Unidos", | |
GB: "Reino Unido", | |
US: "Estados Unidos", | |
UM: "Islas Ultramarinas Menores de Estados Unidos", | |
UY: "Uruguay", | |
UZ: "Uzbekistán", | |
VU: "Vanuatu", | |
VE: "Venezuela", | |
VN: "Vietnam", | |
VG: "Islas Vírgenes Británicas", | |
VI: "Islas Vírgenes de los Estados Unidos", | |
WF: "Wallis y Futuna", | |
EH: "Sahara Occidental", | |
YE: "Yemen", | |
ZM: "Zambia", | |
ZW: "Zimbabue" | |
}; | |
function getCountryName(countryCode) { | |
if (isoCountries.hasOwnProperty(countryCode)) { | |
return isoCountries[countryCode]; | |
} else { | |
return countryCode; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment