Skip to content

Instantly share code, notes, and snippets.

@arminkz
Created February 1, 2021 17:31
Show Gist options
  • Save arminkz/2dacb524c9af7cdde4ecb4717ba208a4 to your computer and use it in GitHub Desktop.
Save arminkz/2dacb524c9af7cdde4ecb4717ba208a4 to your computer and use it in GitHub Desktop.
country-iso-code-typescript
# especially useful for flags in angular
const isoCountries = new Map([
['Afghanistan', 'af'],
['Aland Islands', 'ax'],
['Albania', 'al'],
['Algeria', 'dz'],
['American Samoa', 'as'],
['Andorra', 'ad'],
['Angola', 'ao'],
['Anguilla', 'ai'],
['Antarctica', 'ao'],
['Antigua And Barbuda', 'ag'],
['Argentina', 'ar'],
['Armenia', 'am'],
['Aruba', 'aw'],
['Australia', 'au'],
['Austria', 'at'],
['Azerbaijan', 'az'],
['Bahamas', 'bs'],
['Bahrain', 'bh'],
['Bangladesh', 'bd'],
['Barbados', 'bb'],
['Belarus', 'by'],
['Belgium', 'be'],
['Belize', 'bz'],
['Benin', 'bj'],
['Bermuda', 'bm'],
['Bhutan', 'bt'],
['Bolivia', 'bo'],
['Bosnia And Herzegovina', 'ba'],
['Botswana', 'bw'],
['Bouvet Island', 'bv'],
['Brazil', 'br'],
['British Indian Ocean Territory', 'io'],
['Brunei Darussalam', 'bn'],
['Bulgaria', 'bg'],
['Burkina Faso', 'bf'],
['Burundi', 'bi'],
['Cambodia', 'kh'],
['Cameroon', 'cm'],
['Canada', 'ca'],
['Cape Verde', 'cv'],
['Cayman Islands', 'ky'],
['Central African Republic', 'cf'],
['Chad', 'td'],
['Chile', 'cl'],
['China', 'cn'],
['Christmas Island', 'cx'],
['Cocos (Keeling) Islands', 'cc'],
['Colombia', 'co'],
['Comoros', 'km'],
['Congo', 'cg'],
['Congo, Democratic Republic', 'cd'],
['Cook Islands', 'ck'],
['Costa Rica', 'cr'],
['Cote D\'Ivoire', 'ci'],
['Croatia', 'hr'],
['Cuba', 'cu'],
['Cyprus', 'cy'],
['Czech Republic', 'cz'],
['Denmark', 'dk'],
['Djibouti', 'dj'],
['Dominica', 'dm'],
['Dominican Republic', 'do'],
['Ecuador', 'ec'],
['Egypt', 'eg'],
['El Salvador', 'sv'],
['Equatorial Guinea', 'gq'],
['Eritrea', 'er'],
['Estonia', 'ee'],
['Ethiopia', 'et'],
['Falkland Islands (Malvinas)', 'fk'],
['Faroe Islands', 'fo'],
['Fiji', 'fj'],
['Finland', 'fi'],
['France', 'fr'],
['French Guiana', 'gf'],
['French Polynesia', 'pf'],
['French Southern Territories', 'tf'],
['Gabon', 'ga'],
['Gambia', 'gm'],
['Georgia', 'ge'],
['Germany', 'de'],
['Ghana', 'gh'],
['Gibraltar', 'gi'],
['Greece', 'gr'],
['Greenland', 'gl'],
['Grenada', 'gd'],
['Guadeloupe', 'gp'],
['Guam', 'gu'],
['Guatemala', 'gt'],
['Guernsey', 'gg'],
['Guinea', 'gn'],
['Guinea-Bissau', 'gw'],
['Guyana', 'gy'],
['Haiti', 'ht'],
['Heard Island & Mcdonald Islands', 'hm'],
['Holy See (Vatican City State)', 'va'],
['Honduras', 'hn'],
['Hong Kong', 'hk'],
['Hungary', 'hu'],
['Iceland', 'is'],
['India', 'in'],
['Indonesia', 'id'],
['Iran, Islamic Republic Of', 'ir'],
['Iraq', 'iq'],
['Ireland', 'ie'],
['Isle Of Man', 'im'],
['Israel', 'il'],
['Italy', 'it'],
['Jamaica', 'jm'],
['Japan', 'jp'],
['Jersey', 'je'],
['Jordan', 'jo'],
['Kazakhstan', 'kz'],
['Kenya', 'ke'],
['Kiribati', 'ki'],
['Korea', 'kr'],
['Kuwait', 'kw'],
['Kyrgyzstan', 'kg'],
['Lao People\'s Democratic Republic', 'la'],
['Latvia', 'lv'],
['Lebanon', 'lb'],
['Lesotho', 'ls'],
['Liberia', 'lr'],
['Libyan Arab Jamahiriya', 'ly'],
['Liechtenstein', 'li'],
['Lithuania', 'lt'],
['Luxembourg', 'lu'],
['Macao', 'mo'],
['Macedonia', 'mk'],
['Madagascar', 'mg'],
['Malawi', 'mw'],
['Malaysia', 'my'],
['Maldives', 'mv'],
['Mali', 'ml'],
['Malta', 'mt'],
['Marshall Islands', 'mh'],
['Martinique', 'mq'],
['Mauritania', 'mr'],
['Mauritius', 'mu'],
['Mayotte', 'yt'],
['Mexico', 'mx'],
['Micronesia, Federated States Of', 'fm'],
['Moldova', 'md'],
['Monaco', 'mc'],
['Mongolia', 'mn'],
['Montenegro', 'me'],
['Montserrat', 'ms'],
['Morocco', 'ma'],
['Mozambique', 'mz'],
['Myanmar', 'mm'],
['Namibia', 'na'],
['Nauru', 'nr'],
['Nepal', 'np'],
['Netherlands', 'nl'],
['Netherlands Antilles', 'an'],
['New Caledonia', 'nc'],
['New Zealand', 'nz'],
['Nicaragua', 'ni'],
['Niger', 'ne'],
['Nigeria', 'ng'],
['Niue', 'nu'],
['Norfolk Island', 'nf'],
['Northern Mariana Islands', 'mp'],
['Norway', 'no'],
['Oman', 'om'],
['Pakistan', 'pk'],
['Palau', 'pw'],
['Palestinian Territory', 'ps'],
['Panama', 'pa'],
['Papua New Guinea', 'pg'],
['Paraguay', 'py'],
['Peru', 'pe'],
['Philippines', 'ph'],
['Pitcairn', 'pn'],
['Poland', 'pl'],
['Portugal', 'pt'],
['Puerto Rico', 'pr'],
['Qatar', 'qa'],
['Reunion', 're'],
['Romania', 'ro'],
['Russian Federation', 'ru'],
['Rwanda', 'rw'],
['Saint Barthelemy', 'bl'],
['Saint Helena', 'sh'],
['Saint Kitts And Nevis', 'kn'],
['Saint Lucia', 'lc'],
['Saint Martin', 'mf'],
['Saint Pierre And Miquelon', 'pm'],
['Saint Vincent And Grenadines', 'vc'],
['Samoa', 'ws'],
['San Marino', 'sm'],
['Sao Tome And Principe', 'st'],
['Saudi Arabia', 'sa'],
['Senegal', 'sn'],
['Serbia', 'rs'],
['Seychelles', 'sc'],
['Sierra Leone', 'sl'],
['Singapore', 'sg'],
['Slovakia', 'sk'],
['Slovenia', 'si'],
['Solomon Islands', 'sb'],
['Somalia', 'so'],
['South Africa', 'za'],
['South Georgia And Sandwich Isl.', 'gs'],
['Spain', 'es'],
['Sri Lanka', 'lk'],
['Sudan', 'sd'],
['Suriname', 'sr'],
['Svalbard And Jan Mayen', 'sj'],
['Swaziland', 'sz'],
['Sweden', 'se'],
['Switzerland', 'ch'],
['Syrian Arab Republic', 'sy'],
['Taiwan', 'tw'],
['Tajikistan', 'tj'],
['Tanzania', 'tz'],
['Thailand', 'th'],
['Timor-Leste', 'tl'],
['Togo', 'tg'],
['Tokelau', 'tk'],
['Tonga', 'to'],
['Trinidad And Tobago', 'tt'],
['Tunisia', 'tn'],
['Turkey', 'tr'],
['Turkmenistan', 'tm'],
['Turks And Caicos Islands', 'tc'],
['Tuvalu', 'tv'],
['Uganda', 'ug'],
['Ukraine', 'ua'],
['United Arab Emirates', 'ae'],
['United Kingdom', 'gb'],
['United States', 'us'],
['United States Outlying Islands', 'um'],
['Uruguay', 'uy'],
['Uzbekistan', 'uz'],
['Vanuatu', 'vu'],
['Venezuela', 've'],
['Viet Nam', 'vn'],
['Virgin Islands, British', 'vg'],
['Virgin Islands, U.S.', 'vi'],
['Wallis And Futuna', 'wf'],
['Western Sahara', 'eh'],
['Yemen', 'ye'],
['Zambia', 'zm'],
['Zimbabwe', 'zw']
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment