Skip to content

Instantly share code, notes, and snippets.

@nicbou
Created November 24, 2022 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicbou/fa67c1a1c48251af1fad0ea018ff9993 to your computer and use it in GitHub Desktop.
Save nicbou/fa67c1a1c48251af1fad0ea018ff9993 to your computer and use it in GitHub Desktop.
const countryCodeData = [
{
"country": "Afghanistan",
"abbreviation": "AF"
},
{
"country": "Albania",
"abbreviation": "AL"
},
{
"country": "Algeria",
"abbreviation": "DZ"
},
{
"country": "American Samoa",
"abbreviation": "AS"
},
{
"country": "Andorra",
"abbreviation": "AD"
},
{
"country": "Angola",
"abbreviation": "AO"
},
{
"country": "Anguilla",
"abbreviation": "AI"
},
{
"country": "Antarctica",
"abbreviation": "AQ"
},
{
"country": "Antigua and Barbuda",
"abbreviation": "AG"
},
{
"country": "Argentina",
"abbreviation": "AR"
},
{
"country": "Armenia",
"abbreviation": "AM"
},
{
"country": "Aruba",
"abbreviation": "AW"
},
{
"country": "Australia",
"abbreviation": "AU"
},
{
"country": "Austria",
"abbreviation": "AT"
},
{
"country": "Azerbaijan",
"abbreviation": "AZ"
},
{
"country": "Bahamas",
"abbreviation": "BS"
},
{
"country": "Bahrain",
"abbreviation": "BH"
},
{
"country": "Bangladesh",
"abbreviation": "BD"
},
{
"country": "Barbados",
"abbreviation": "BB"
},
{
"country": "Belarus",
"abbreviation": "BY"
},
{
"country": "Belgium",
"abbreviation": "BE"
},
{
"country": "Belize",
"abbreviation": "BZ"
},
{
"country": "Benin",
"abbreviation": "BJ"
},
{
"country": "Bermuda",
"abbreviation": "BM"
},
{
"country": "Bhutan",
"abbreviation": "BT"
},
{
"country": "Bolivia",
"abbreviation": "BO"
},
{
"country": "Bosnia and Herzegovina",
"abbreviation": "BA"
},
{
"country": "Botswana",
"abbreviation": "BW"
},
{
"country": "Bouvet Island",
"abbreviation": "BV"
},
{
"country": "Brazil",
"abbreviation": "BR"
},
{
"country": "British Indian Ocean Territory",
"abbreviation": "IO"
},
{
"country": "Brunei",
"abbreviation": "BN"
},
{
"country": "Bulgaria",
"abbreviation": "BG"
},
{
"country": "Burkina Faso",
"abbreviation": "BF"
},
{
"country": "Burundi",
"abbreviation": "BI"
},
{
"country": "Cambodia",
"abbreviation": "KH"
},
{
"country": "Cameroon",
"abbreviation": "CM"
},
{
"country": "Canada",
"abbreviation": "CA"
},
{
"country": "Cape Verde",
"abbreviation": "CV"
},
{
"country": "Cayman Islands",
"abbreviation": "KY"
},
{
"country": "Central African Republic",
"abbreviation": "CF"
},
{
"country": "Chad",
"abbreviation": "TD"
},
{
"country": "Chile",
"abbreviation": "CL"
},
{
"country": "China",
"abbreviation": "CN"
},
{
"country": "Christmas Island",
"abbreviation": "CX"
},
{
"country": "Cocos (Keeling) Islands",
"abbreviation": "CC"
},
{
"country": "Colombia",
"abbreviation": "CO"
},
{
"country": "Comoros",
"abbreviation": "KM"
},
{
"country": "Congo",
"abbreviation": "CG"
},
{
"country": "Cook Islands",
"abbreviation": "CK"
},
{
"country": "Costa Rica",
"abbreviation": "CR"
},
{
"country": "Croatia",
"abbreviation": "HR"
},
{
"country": "Cuba",
"abbreviation": "CU"
},
{
"country": "Cyprus",
"abbreviation": "CY"
},
{
"country": "Czech Republic",
"abbreviation": "CZ"
},
{
"country": "Denmark",
"abbreviation": "DK"
},
{
"country": "Djibouti",
"abbreviation": "DJ"
},
{
"country": "Dominica",
"abbreviation": "DM"
},
{
"country": "Dominican Republic",
"abbreviation": "DO"
},
{
"country": "East Timor",
"abbreviation": "TP"
},
{
"country": "Ecuador",
"abbreviation": "EC"
},
{
"country": "Egypt",
"abbreviation": "EG"
},
{
"country": "El Salvador",
"abbreviation": "SV"
},
{
"country": "Equatorial Guinea",
"abbreviation": "GQ"
},
{
"country": "Eritrea",
"abbreviation": "ER"
},
{
"country": "Estonia",
"abbreviation": "EE"
},
{
"country": "Ethiopia",
"abbreviation": "ET"
},
{
"country": "Falkland Islands",
"abbreviation": "FK"
},
{
"country": "Faroe Islands",
"abbreviation": "FO"
},
{
"country": "Fiji Islands",
"abbreviation": "FJ"
},
{
"country": "Finland",
"abbreviation": "FI"
},
{
"country": "France",
"abbreviation": "FR"
},
{
"country": "French Guiana",
"abbreviation": "GF"
},
{
"country": "French Polynesia",
"abbreviation": "PF"
},
{
"country": "French Southern territories",
"abbreviation": "TF"
},
{
"country": "Gabon",
"abbreviation": "GA"
},
{
"country": "Gambia",
"abbreviation": "GM"
},
{
"country": "Georgia",
"abbreviation": "GE"
},
{
"country": "Germany",
"abbreviation": "DE"
},
{
"country": "Ghana",
"abbreviation": "GH"
},
{
"country": "Gibraltar",
"abbreviation": "GI"
},
{
"country": "Greece",
"abbreviation": "GR"
},
{
"country": "Greenland",
"abbreviation": "GL"
},
{
"country": "Grenada",
"abbreviation": "GD"
},
{
"country": "Guadeloupe",
"abbreviation": "GP"
},
{
"country": "Guam",
"abbreviation": "GU"
},
{
"country": "Guatemala",
"abbreviation": "GT"
},
{
"country": "Guernsey",
"abbreviation": "GG"
},
{
"country": "Guinea",
"abbreviation": "GN"
},
{
"country": "Guinea-Bissau",
"abbreviation": "GW"
},
{
"country": "Guyana",
"abbreviation": "GY"
},
{
"country": "Haiti",
"abbreviation": "HT"
},
{
"country": "Heard Island and McDonald Islands",
"abbreviation": "HM"
},
{
"country": "Holy See (Vatican City State)",
"abbreviation": "VA"
},
{
"country": "Honduras",
"abbreviation": "HN"
},
{
"country": "Hong Kong",
"abbreviation": "HK"
},
{
"country": "Hungary",
"abbreviation": "HU"
},
{
"country": "Iceland",
"abbreviation": "IS"
},
{
"country": "India",
"abbreviation": "IN"
},
{
"country": "Indonesia",
"abbreviation": "ID"
},
{
"country": "Iran",
"abbreviation": "IR"
},
{
"country": "Iraq",
"abbreviation": "IQ"
},
{
"country": "Ireland",
"abbreviation": "IE"
},
{
"country": "Isle of Man",
"abbreviation": "IM"
},
{
"country": "Israel",
"abbreviation": "IL"
},
{
"country": "Italy",
"abbreviation": "IT"
},
{
"country": "Ivory Coast",
"abbreviation": "CI"
},
{
"country": "Jamaica",
"abbreviation": "JM"
},
{
"country": "Japan",
"abbreviation": "JP"
},
{
"country": "Jersey",
"abbreviation": "JE"
},
{
"country": "Jordan",
"abbreviation": "JO"
},
{
"country": "Kazakhstan",
"abbreviation": "KZ"
},
{
"country": "Kenya",
"abbreviation": "KE"
},
{
"country": "Kiribati",
"abbreviation": "KI"
},
{
"country": "Kuwait",
"abbreviation": "KW"
},
{
"country": "Kyrgyzstan",
"abbreviation": "KG"
},
{
"country": "Laos",
"abbreviation": "LA"
},
{
"country": "Latvia",
"abbreviation": "LV"
},
{
"country": "Lebanon",
"abbreviation": "LB"
},
{
"country": "Lesotho",
"abbreviation": "LS"
},
{
"country": "Liberia",
"abbreviation": "LR"
},
{
"country": "Libyan Arab Jamahiriya",
"abbreviation": "LY"
},
{
"country": "Liechtenstein",
"abbreviation": "LI"
},
{
"country": "Lithuania",
"abbreviation": "LT"
},
{
"country": "Luxembourg",
"abbreviation": "LU"
},
{
"country": "Macao",
"abbreviation": "MO"
},
{
"country": "North Macedonia",
"abbreviation": "MK"
},
{
"country": "Madagascar",
"abbreviation": "MG"
},
{
"country": "Malawi",
"abbreviation": "MW"
},
{
"country": "Malaysia",
"abbreviation": "MY"
},
{
"country": "Maldives",
"abbreviation": "MV"
},
{
"country": "Mali",
"abbreviation": "ML"
},
{
"country": "Malta",
"abbreviation": "MT"
},
{
"country": "Marshall Islands",
"abbreviation": "MH"
},
{
"country": "Martinique",
"abbreviation": "MQ"
},
{
"country": "Mauritania",
"abbreviation": "MR"
},
{
"country": "Mauritius",
"abbreviation": "MU"
},
{
"country": "Mayotte",
"abbreviation": "YT"
},
{
"country": "Mexico",
"abbreviation": "MX"
},
{
"country": "Micronesia, Federated States of",
"abbreviation": "FM"
},
{
"country": "Moldova",
"abbreviation": "MD"
},
{
"country": "Monaco",
"abbreviation": "MC"
},
{
"country": "Mongolia",
"abbreviation": "MN"
},
{
"country": "Montenegro",
"abbreviation": "ME"
},
{
"country": "Montserrat",
"abbreviation": "MS"
},
{
"country": "Morocco",
"abbreviation": "MA"
},
{
"country": "Mozambique",
"abbreviation": "MZ"
},
{
"country": "Myanmar",
"abbreviation": "MM"
},
{
"country": "Namibia",
"abbreviation": "NA"
},
{
"country": "Nauru",
"abbreviation": "NR"
},
{
"country": "Nepal",
"abbreviation": "NP"
},
{
"country": "Netherlands",
"abbreviation": "NL"
},
{
"country": "Netherlands Antilles",
"abbreviation": "AN"
},
{
"country": "New Caledonia",
"abbreviation": "NC"
},
{
"country": "New Zealand",
"abbreviation": "NZ"
},
{
"country": "Nicaragua",
"abbreviation": "NI"
},
{
"country": "Niger",
"abbreviation": "NE"
},
{
"country": "Nigeria",
"abbreviation": "NG"
},
{
"country": "Niue",
"abbreviation": "NU"
},
{
"country": "Norfolk Island",
"abbreviation": "NF"
},
{
"country": "North Korea",
"abbreviation": "KP"
},
{
"country": "Northern Ireland",
"abbreviation": "GB"
},
{
"country": "Northern Mariana Islands",
"abbreviation": "MP"
},
{
"country": "Norway",
"abbreviation": "NO"
},
{
"country": "Oman",
"abbreviation": "OM"
},
{
"country": "Pakistan",
"abbreviation": "PK"
},
{
"country": "Palau",
"abbreviation": "PW"
},
{
"country": "Palestine",
"abbreviation": "PS"
},
{
"country": "Panama",
"abbreviation": "PA"
},
{
"country": "Papua New Guinea",
"abbreviation": "PG"
},
{
"country": "Paraguay",
"abbreviation": "PY"
},
{
"country": "Peru",
"abbreviation": "PE"
},
{
"country": "Philippines",
"abbreviation": "PH"
},
{
"country": "Pitcairn",
"abbreviation": "PN"
},
{
"country": "Poland",
"abbreviation": "PL"
},
{
"country": "Portugal",
"abbreviation": "PT"
},
{
"country": "Puerto Rico",
"abbreviation": "PR"
},
{
"country": "Qatar",
"abbreviation": "QA"
},
{
"country": "Reunion",
"abbreviation": "RE"
},
{
"country": "Romania",
"abbreviation": "RO"
},
{
"country": "Russian Federation",
"abbreviation": "RU"
},
{
"country": "Rwanda",
"abbreviation": "RW"
},
{
"country": "Saint Helena",
"abbreviation": "SH"
},
{
"country": "Saint Kitts and Nevis",
"abbreviation": "KN"
},
{
"country": "Saint Lucia",
"abbreviation": "LC"
},
{
"country": "Saint Pierre and Miquelon",
"abbreviation": "PM"
},
{
"country": "Saint Vincent and the Grenadines",
"abbreviation": "VC"
},
{
"country": "Samoa",
"abbreviation": "WS"
},
{
"country": "San Marino",
"abbreviation": "SM"
},
{
"country": "Sao Tome and Principe",
"abbreviation": "ST"
},
{
"country": "Saudi Arabia",
"abbreviation": "SA"
},
{
"country": "Senegal",
"abbreviation": "SN"
},
{
"country": "Serbia",
"abbreviation": "RS"
},
{
"country": "Seychelles",
"abbreviation": "SC"
},
{
"country": "Sierra Leone",
"abbreviation": "SL"
},
{
"country": "Singapore",
"abbreviation": "SG"
},
{
"country": "Slovakia",
"abbreviation": "SK"
},
{
"country": "Slovenia",
"abbreviation": "SI"
},
{
"country": "Solomon Islands",
"abbreviation": "SB"
},
{
"country": "Somalia",
"abbreviation": "SO"
},
{
"country": "South Africa",
"abbreviation": "ZA"
},
{
"country": "South Georgia and the South Sandwich Islands",
"abbreviation": "GS"
},
{
"country": "South Korea",
"abbreviation": "KR"
},
{
"country": "South Sudan",
"abbreviation": "SS"
},
{
"country": "Spain",
"abbreviation": "ES"
},
{
"country": "Sri Lanka",
"abbreviation": "LK"
},
{
"country": "Sudan",
"abbreviation": "SD"
},
{
"country": "Suriname",
"abbreviation": "SR"
},
{
"country": "Svalbard and Jan Mayen",
"abbreviation": "SJ"
},
{
"country": "Swaziland",
"abbreviation": "SZ"
},
{
"country": "Sweden",
"abbreviation": "SE"
},
{
"country": "Switzerland",
"abbreviation": "CH"
},
{
"country": "Syria",
"abbreviation": "SY"
},
{
"country": "Tajikistan",
"abbreviation": "TJ"
},
{
"country": "Tanzania",
"abbreviation": "TZ"
},
{
"country": "Thailand",
"abbreviation": "TH"
},
{
"country": "The Democratic Republic of Congo",
"abbreviation": "CD"
},
{
"country": "Timor-Leste",
"abbreviation": "TL"
},
{
"country": "Togo",
"abbreviation": "TG"
},
{
"country": "Tokelau",
"abbreviation": "TK"
},
{
"country": "Tonga",
"abbreviation": "TO"
},
{
"country": "Trinidad and Tobago",
"abbreviation": "TT"
},
{
"country": "Tunisia",
"abbreviation": "TN"
},
{
"country": "Turkey",
"abbreviation": "TR"
},
{
"country": "Turkmenistan",
"abbreviation": "TM"
},
{
"country": "Turks and Caicos Islands",
"abbreviation": "TC"
},
{
"country": "Tuvalu",
"abbreviation": "TV"
},
{
"country": "Uganda",
"abbreviation": "UG"
},
{
"country": "Ukraine",
"abbreviation": "UA"
},
{
"country": "United Arab Emirates",
"abbreviation": "AE"
},
{
"country": "United Kingdom",
"abbreviation": "UK"
},
{
"country": "United States",
"abbreviation": "US"
},
{
"country": "United States Minor Outlying Islands",
"abbreviation": "UM"
},
{
"country": "Uruguay",
"abbreviation": "UY"
},
{
"country": "Uzbekistan",
"abbreviation": "UZ"
},
{
"country": "Vanuatu",
"abbreviation": "VU"
},
{
"country": "Venezuela",
"abbreviation": "VE"
},
{
"country": "Vietnam",
"abbreviation": "VN"
},
{
"country": "Virgin Islands, British",
"abbreviation": "VG"
},
{
"country": "Virgin Islands, U.S.",
"abbreviation": "VI"
},
{
"country": "Wallis and Futuna",
"abbreviation": "WF"
},
{
"country": "Western Sahara",
"abbreviation": "EH"
},
{
"country": "Yemen",
"abbreviation": "YE"
},
{
"country": "Zambia",
"abbreviation": "ZM"
},
{
"country": "Zimbabwe",
"abbreviation": "ZW"
}
]
const currencyCodeData = [
{
"country": "Afghanistan",
"currency_code": "AFN"
},
{
"country": "Albania",
"currency_code": "ALL"
},
{
"country": "Algeria",
"currency_code": "DZD"
},
{
"country": "American Samoa",
"currency_code": "USD"
},
{
"country": "Andorra",
"currency_code": "EUR"
},
{
"country": "Angola",
"currency_code": "AOA"
},
{
"country": "Anguilla",
"currency_code": "XCD"
},
{
"country": "Antarctica",
"currency_code": "XCD"
},
{
"country": "Antigua and Barbuda",
"currency_code": "XCD"
},
{
"country": "Argentina",
"currency_code": "ARS"
},
{
"country": "Armenia",
"currency_code": "AMD"
},
{
"country": "Aruba",
"currency_code": "AWG"
},
{
"country": "Australia",
"currency_code": "AUD"
},
{
"country": "Austria",
"currency_code": "EUR"
},
{
"country": "Azerbaijan",
"currency_code": "AZN"
},
{
"country": "Bahamas",
"currency_code": "BSD"
},
{
"country": "Bahrain",
"currency_code": "BHD"
},
{
"country": "Bangladesh",
"currency_code": "BDT"
},
{
"country": "Barbados",
"currency_code": "BBD"
},
{
"country": "Belarus",
"currency_code": "BYR"
},
{
"country": "Belgium",
"currency_code": "EUR"
},
{
"country": "Belize",
"currency_code": "BZD"
},
{
"country": "Benin",
"currency_code": "XOF"
},
{
"country": "Bermuda",
"currency_code": "BMD"
},
{
"country": "Bhutan",
"currency_code": "BTN"
},
{
"country": "Bolivia",
"currency_code": "BOB"
},
{
"country": "Bosnia and Herzegovina",
"currency_code": "BAM"
},
{
"country": "Botswana",
"currency_code": "BWP"
},
{
"country": "Bouvet Island",
"currency_code": "NOK"
},
{
"country": "Brazil",
"currency_code": "BRL"
},
{
"country": "British Indian Ocean Territory",
"currency_code": "USD"
},
{
"country": "Brunei",
"currency_code": "BND"
},
{
"country": "Bulgaria",
"currency_code": "BGN"
},
{
"country": "Burkina Faso",
"currency_code": "XOF"
},
{
"country": "Burundi",
"currency_code": "BIF"
},
{
"country": "Cambodia",
"currency_code": "KHR"
},
{
"country": "Cameroon",
"currency_code": "XAF"
},
{
"country": "Canada",
"currency_code": "CAD"
},
{
"country": "Cape Verde",
"currency_code": "CVE"
},
{
"country": "Cayman Islands",
"currency_code": "KYD"
},
{
"country": "Central African Republic",
"currency_code": "XAF"
},
{
"country": "Chad",
"currency_code": "XAF"
},
{
"country": "Chile",
"currency_code": "CLP"
},
{
"country": "China",
"currency_code": "CNY"
},
{
"country": "Christmas Island",
"currency_code": "AUD"
},
{
"country": "Cocos (Keeling) Islands",
"currency_code": "AUD"
},
{
"country": "Colombia",
"currency_code": "COP"
},
{
"country": "Comoros",
"currency_code": "KMF"
},
{
"country": "Congo",
"currency_code": "XAF"
},
{
"country": "Cook Islands",
"currency_code": "NZD"
},
{
"country": "Costa Rica",
"currency_code": "CRC"
},
{
"country": "Croatia",
"currency_code": "HRK"
},
{
"country": "Cuba",
"currency_code": "CUP"
},
{
"country": "Cyprus",
"currency_code": "EUR"
},
{
"country": "Czech Republic",
"currency_code": "CZK"
},
{
"country": "Denmark",
"currency_code": "DKK"
},
{
"country": "Djibouti",
"currency_code": "DJF"
},
{
"country": "Dominica",
"currency_code": "XCD"
},
{
"country": "Dominican Republic",
"currency_code": "DOP"
},
{
"country": "East Timor",
"currency_code": "USD"
},
{
"country": "Ecuador",
"currency_code": "ECS"
},
{
"country": "Egypt",
"currency_code": "EGP"
},
{
"country": "El Salvador",
"currency_code": "SVC"
},
{
"country": "England",
"currency_code": "GBP"
},
{
"country": "Equatorial Guinea",
"currency_code": "XAF"
},
{
"country": "Eritrea",
"currency_code": "ERN"
},
{
"country": "Estonia",
"currency_code": "EUR"
},
{
"country": "Ethiopia",
"currency_code": "ETB"
},
{
"country": "Falkland Islands",
"currency_code": "FKP"
},
{
"country": "Faroe Islands",
"currency_code": "DKK"
},
{
"country": "Fiji Islands",
"currency_code": "FJD"
},
{
"country": "Finland",
"currency_code": "EUR"
},
{
"country": "France",
"currency_code": "EUR"
},
{
"country": "French Guiana",
"currency_code": "EUR"
},
{
"country": "French Polynesia",
"currency_code": "XPF"
},
{
"country": "French Southern territories",
"currency_code": "EUR"
},
{
"country": "Gabon",
"currency_code": "XAF"
},
{
"country": "Gambia",
"currency_code": "GMD"
},
{
"country": "Georgia",
"currency_code": "GEL"
},
{
"country": "Germany",
"currency_code": "EUR"
},
{
"country": "Ghana",
"currency_code": "GHS"
},
{
"country": "Gibraltar",
"currency_code": "GIP"
},
{
"country": "Greece",
"currency_code": "EUR"
},
{
"country": "Greenland",
"currency_code": "DKK"
},
{
"country": "Grenada",
"currency_code": "XCD"
},
{
"country": "Guadeloupe",
"currency_code": "EUR"
},
{
"country": "Guam",
"currency_code": "USD"
},
{
"country": "Guatemala",
"currency_code": "QTQ"
},
{
"country": "Guinea",
"currency_code": "GNF"
},
{
"country": "Guinea-Bissau",
"currency_code": "CFA"
},
{
"country": "Guyana",
"currency_code": "GYD"
},
{
"country": "Haiti",
"currency_code": "HTG"
},
{
"country": "Heard Island and McDonald Islands",
"currency_code": "AUD"
},
{
"country": "Holy See (Vatican City State)",
"currency_code": "EUR"
},
{
"country": "Honduras",
"currency_code": "HNL"
},
{
"country": "Hong Kong",
"currency_code": "HKD"
},
{
"country": "Hungary",
"currency_code": "HUF"
},
{
"country": "Iceland",
"currency_code": "ISK"
},
{
"country": "India",
"currency_code": "INR"
},
{
"country": "Indonesia",
"currency_code": "IDR"
},
{
"country": "Iran",
"currency_code": "IRR"
},
{
"country": "Iraq",
"currency_code": "IQD"
},
{
"country": "Ireland",
"currency_code": "EUR"
},
{
"country": "Israel",
"currency_code": "ILS"
},
{
"country": "Italy",
"currency_code": "EUR"
},
{
"country": "Ivory Coast",
"currency_code": "XOF"
},
{
"country": "Jamaica",
"currency_code": "JMD"
},
{
"country": "Japan",
"currency_code": "JPY"
},
{
"country": "Jordan",
"currency_code": "JOD"
},
{
"country": "Kazakhstan",
"currency_code": "KZT"
},
{
"country": "Kenya",
"currency_code": "KES"
},
{
"country": "Kiribati",
"currency_code": "AUD"
},
{
"country": "Kuwait",
"currency_code": "KWD"
},
{
"country": "Kyrgyzstan",
"currency_code": "KGS"
},
{
"country": "Laos",
"currency_code": "LAK"
},
{
"country": "Latvia",
"currency_code": "LVL"
},
{
"country": "Lebanon",
"currency_code": "LBP"
},
{
"country": "Lesotho",
"currency_code": "LSL"
},
{
"country": "Liberia",
"currency_code": "LRD"
},
{
"country": "Libyan Arab Jamahiriya",
"currency_code": "LYD"
},
{
"country": "Liechtenstein",
"currency_code": "CHF"
},
{
"country": "Lithuania",
"currency_code": "LTL"
},
{
"country": "Luxembourg",
"currency_code": "EUR"
},
{
"country": "Macau",
"currency_code": "MOP"
},
{
"country": "North Macedonia",
"currency_code": "MKD"
},
{
"country": "Madagascar",
"currency_code": "MGF"
},
{
"country": "Malawi",
"currency_code": "MWK"
},
{
"country": "Malaysia",
"currency_code": "MYR"
},
{
"country": "Maldives",
"currency_code": "MVR"
},
{
"country": "Mali",
"currency_code": "XOF"
},
{
"country": "Malta",
"currency_code": "EUR"
},
{
"country": "Marshall Islands",
"currency_code": "USD"
},
{
"country": "Martinique",
"currency_code": "EUR"
},
{
"country": "Mauritania",
"currency_code": "MRO"
},
{
"country": "Mauritius",
"currency_code": "MUR"
},
{
"country": "Mayotte",
"currency_code": "EUR"
},
{
"country": "Mexico",
"currency_code": "MXN"
},
{
"country": "Micronesia, Federated States of",
"currency_code": "USD"
},
{
"country": "Moldova",
"currency_code": "MDL"
},
{
"country": "Monaco",
"currency_code": "EUR"
},
{
"country": "Mongolia",
"currency_code": "MNT"
},
{
"country": "Montserrat",
"currency_code": "XCD"
},
{
"country": "Morocco",
"currency_code": "MAD"
},
{
"country": "Mozambique",
"currency_code": "MZN"
},
{
"country": "Myanmar",
"currency_code": "MMR"
},
{
"country": "Namibia",
"currency_code": "NAD"
},
{
"country": "Nauru",
"currency_code": "AUD"
},
{
"country": "Nepal",
"currency_code": "NPR"
},
{
"country": "Netherlands",
"currency_code": "EUR"
},
{
"country": "Netherlands Antilles",
"currency_code": "ANG"
},
{
"country": "New Caledonia",
"currency_code": "XPF"
},
{
"country": "New Zealand",
"currency_code": "NZD"
},
{
"country": "Nicaragua",
"currency_code": "NIO"
},
{
"country": "Niger",
"currency_code": "XOF"
},
{
"country": "Nigeria",
"currency_code": "NGN"
},
{
"country": "Niue",
"currency_code": "NZD"
},
{
"country": "Norfolk Island",
"currency_code": "AUD"
},
{
"country": "North Korea",
"currency_code": "KPW"
},
{
"country": "Northern Ireland",
"currency_code": "GBP"
},
{
"country": "Northern Mariana Islands",
"currency_code": "USD"
},
{
"country": "Norway",
"currency_code": "NOK"
},
{
"country": "Oman",
"currency_code": "OMR"
},
{
"country": "Pakistan",
"currency_code": "PKR"
},
{
"country": "Palau",
"currency_code": "USD"
},
{
"country": "Palestine",
"currency_code": null
},
{
"country": "Panama",
"currency_code": "PAB"
},
{
"country": "Papua New Guinea",
"currency_code": "PGK"
},
{
"country": "Paraguay",
"currency_code": "PYG"
},
{
"country": "Peru",
"currency_code": "PEN"
},
{
"country": "Philippines",
"currency_code": "PHP"
},
{
"country": "Pitcairn Islands",
"currency_code": "NZD"
},
{
"country": "Poland",
"currency_code": "PLN"
},
{
"country": "Portugal",
"currency_code": "EUR"
},
{
"country": "Puerto Rico",
"currency_code": "USD"
},
{
"country": "Qatar",
"currency_code": "QAR"
},
{
"country": "Reunion",
"currency_code": "EUR"
},
{
"country": "Romania",
"currency_code": "RON"
},
{
"country": "Russian Federation",
"currency_code": "RUB"
},
{
"country": "Rwanda",
"currency_code": "RWF"
},
{
"country": "Saint Helena",
"currency_code": "SHP"
},
{
"country": "Saint Kitts and Nevis",
"currency_code": "XCD"
},
{
"country": "Saint Lucia",
"currency_code": "XCD"
},
{
"country": "Saint Pierre and Miquelon",
"currency_code": "EUR"
},
{
"country": "Saint Vincent and the Grenadines",
"currency_code": "XCD"
},
{
"country": "Samoa",
"currency_code": "WST"
},
{
"country": "San Marino",
"currency_code": "EUR"
},
{
"country": "Sao Tome and Principe",
"currency_code": "STD"
},
{
"country": "Saudi Arabia",
"currency_code": "SAR"
},
{
"country": "Scotland",
"currency_code": "GBP"
},
{
"country": "Senegal",
"currency_code": "XOF"
},
{
"country": "Serbia",
"currency_code": "RSD"
},
{
"country": "Seychelles",
"currency_code": "SCR"
},
{
"country": "Sierra Leone",
"currency_code": "SLL"
},
{
"country": "Singapore",
"currency_code": "SGD"
},
{
"country": "Slovakia",
"currency_code": "EUR"
},
{
"country": "Slovenia",
"currency_code": "EUR"
},
{
"country": "Solomon Islands",
"currency_code": "SBD"
},
{
"country": "Somalia",
"currency_code": "SOS"
},
{
"country": "South Africa",
"currency_code": "ZAR"
},
{
"country": "South Georgia and the South Sandwich Islands",
"currency_code": "GBP"
},
{
"country": "South Korea",
"currency_code": "KRW"
},
{
"country": "South Sudan",
"currency_code": "SSP"
},
{
"country": "Spain",
"currency_code": "EUR"
},
{
"country": "Sri Lanka",
"currency_code": "LKR"
},
{
"country": "Sudan",
"currency_code": "SDG"
},
{
"country": "Suriname",
"currency_code": "SRD"
},
{
"country": "Svalbard and Jan Mayen",
"currency_code": "NOK"
},
{
"country": "Swaziland",
"currency_code": "SZL"
},
{
"country": "Sweden",
"currency_code": "SEK"
},
{
"country": "Switzerland",
"currency_code": "CHF"
},
{
"country": "Syria",
"currency_code": "SYP"
},
{
"country": "Tajikistan",
"currency_code": "TJS"
},
{
"country": "Tanzania",
"currency_code": "TZS"
},
{
"country": "Thailand",
"currency_code": "THB"
},
{
"country": "The Democratic Republic of Congo",
"currency_code": "CDF"
},
{
"country": "Togo",
"currency_code": "XOF"
},
{
"country": "Tokelau",
"currency_code": "NZD"
},
{
"country": "Tonga",
"currency_code": "TOP"
},
{
"country": "Trinidad and Tobago",
"currency_code": "TTD"
},
{
"country": "Tunisia",
"currency_code": "TND"
},
{
"country": "Turkey",
"currency_code": "TRY"
},
{
"country": "Turkmenistan",
"currency_code": "TMT"
},
{
"country": "Turks and Caicos Islands",
"currency_code": "USD"
},
{
"country": "Tuvalu",
"currency_code": "AUD"
},
{
"country": "Uganda",
"currency_code": "UGX"
},
{
"country": "Ukraine",
"currency_code": "UAH"
},
{
"country": "United Arab Emirates",
"currency_code": "AED"
},
{
"country": "United Kingdom",
"currency_code": "GBP"
},
{
"country": "United States",
"currency_code": "USD"
},
{
"country": "United States Minor Outlying Islands",
"currency_code": "USD"
},
{
"country": "Uruguay",
"currency_code": "UYU"
},
{
"country": "Uzbekistan",
"currency_code": "UZS"
},
{
"country": "Vanuatu",
"currency_code": "VUV"
},
{
"country": "Venezuela",
"currency_code": "VEF"
},
{
"country": "Vietnam",
"currency_code": "VND"
},
{
"country": "Virgin Islands, British",
"currency_code": "USD"
},
{
"country": "Virgin Islands, U.S.",
"currency_code": "USD"
},
{
"country": "Wales",
"currency_code": "GBP"
},
{
"country": "Wallis and Futuna",
"currency_code": "XPF"
},
{
"country": "Western Sahara",
"currency_code": "MAD"
},
{
"country": "Yemen",
"currency_code": "YER"
},
{
"country": "Zambia",
"currency_code": "ZMW"
},
{
"country": "Zimbabwe",
"currency_code": "ZWD"
}
];
const countryToCountryCodes = countryCodeData.reduce((countryCodes, record) => {
countryCodes[record['country']] = record['abbreviation'];
return countryCodes;
}, {});
const countryToCurrencyCodes = currencyCodeData.reduce((currencyCodes, record) => {
currencyCodes[record['country']] = record['currency_code'];
return currencyCodes;
}, {});
const countryCodeToCurrencyCode = {}
const currencyCodeToCountryCode = {}
Object.entries(countryToCountryCodes).forEach(([country, countryCode]) => {
if(countryToCurrencyCodes[country]) {
countryCodeToCurrencyCode[countryCode] = countryToCurrencyCodes[country];
currencyCodeToCountryCode[countryToCurrencyCodes[country]] = countryCode;
}
});
fetch('https://openexchangerates.org/api/latest.json?app_id=YOUR_APP_ID').then(r => r.json()).then(data => {
const usefulCurrencies = new Set(Object.keys(data.rates).filter(currencyCode => (currencyCode in currencyCodeToCountryCode)));
const usefulCountryCodes = Object.fromEntries(
Object.entries(countryCodeToCurrencyCode).filter(([countryCode, currencyCode]) => usefulCurrencies.has(currencyCode))
);
console.log(usefulCountryCodes);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment