Skip to content

Instantly share code, notes, and snippets.

@ben1one
Created July 9, 2019 07:43
Show Gist options
  • Save ben1one/4d5fbe0bc1f8f6640fac06ac0b615242 to your computer and use it in GitHub Desktop.
Save ben1one/4d5fbe0bc1f8f6640fac06ac0b615242 to your computer and use it in GitHub Desktop.
let jay = {
"AF": "Afghanistan",
"AX": "Åland Islands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
"AG": "Antigua and Barbuda",
"AR": "Argentina",
"AM": "Armenia",
"AW": "Aruba",
"AU": "Australia",
"AT": "Austria",
"AZ": "Azerbaijan",
"BS": "Bahamas",
"BH": "Bahrain",
"BD": "Bangladesh",
"BB": "Barbados",
"BY": "Belarus",
"BE": "Belgium",
"BZ": "Belize",
"BJ": "Benin",
"BM": "Bermuda",
"BT": "Bhutan",
"BO": "Bolivia (Plurinational State of)",
"BQ": "Bonaire, Sint Eustatius and Saba",
"BA": "Bosnia and Herzegovina",
"BW": "Botswana",
"BV": "Bouvet Island",
"BR": "Brazil",
"IO": "British Indian Ocean Territory",
"BN": "Brunei Darussalam",
"BG": "Bulgaria",
"BF": "Burkina Faso",
"BI": "Burundi",
"CV": "Cabo Verde",
"KH": "Cambodia",
"CM": "Cameroon",
"CA": "Canada",
"KY": "Cayman Islands",
"CF": "Central African Republic",
"TD": "Chad",
"CL": "Chile",
"CN": "China",
"CX": "Christmas Island",
"CC": "Cocos (Keeling) Islands",
"CO": "Colombia",
"KM": "Comoros",
"CG": "Congo (Republic of the)",
"CD": "Congo (Democratic Republic of the)",
"CK": "Cook Islands",
"CR": "Costa Rica",
"CI": "Côte d'Ivoire",
"HR": "Croatia",
"CU": "Cuba",
"CW": "Curaçao",
"CY": "Cyprus",
"CZ": "Czech Republic",
"DK": "Denmark",
"DJ": "Djibouti",
"DM": "Dominica",
"DO": "Dominican Republic",
"EC": "Ecuador",
"EG": "Egypt",
"SV": "El Salvador",
"GQ": "Equatorial Guinea",
"ER": "Eritrea",
"EE": "Estonia",
"SZ": "Eswatini",
"ET": "Ethiopia",
"FK": "Falkland Islands (Malvinas)",
"FO": "Faroe Islands",
"FJ": "Fiji",
"FI": "Finland",
"FR": "France",
"GF": "French Guiana",
"PF": "French Polynesia",
"TF": "French Southern Territories",
"GA": "Gabon",
"GM": "Gambia",
"GE": "Georgia",
"DE": "Germany",
"GH": "Ghana",
"GI": "Gibraltar",
"GR": "Greece",
"GL": "Greenland",
"GD": "Grenada",
"GP": "Guadeloupe",
"GU": "Guam",
"GT": "Guatemala",
"GG": "Guernsey",
"GN": "Guinea",
"GW": "Guinea-Bissau",
"GY": "Guyana",
"HT": "Haiti",
"HM": "Heard Island and McDonald Islands",
"VA": "Vatican City State",
"HN": "Honduras",
"HK": "Hong Kong",
"HU": "Hungary",
"IS": "Iceland",
"IN": "India",
"ID": "Indonesia",
"IR": "Iran",
"IQ": "Iraq",
"IE": "Ireland",
"IM": "Isle of Man",
"IL": "Israel",
"IT": "Italy",
"JM": "Jamaica",
"JP": "Japan",
"JE": "Jersey",
"JO": "Jordan",
"KZ": "Kazakhstan",
"KE": "Kenya",
"KI": "Kiribati",
"KP": "Korea (Democratic People's Republic of)",
"KR": "Korea (Republic of)",
"KW": "Kuwait",
"KG": "Kyrgyzstan",
"LA": "Lao People's Democratic Republic",
"LV": "Latvia",
"LB": "Lebanon",
"LS": "Lesotho",
"LR": "Liberia",
"LY": "Libya",
"LI": "Liechtenstein",
"LT": "Lithuania",
"LU": "Luxembourg",
"MO": "Macao",
"MK": "Macedonia (the former Yugoslav Republic of)",
"MG": "Madagascar",
"MW": "Malawi",
"MY": "Malaysia",
"MV": "Maldives",
"ML": "Mali",
"MT": "Malta",
"MH": "Marshall Islands",
"MQ": "Martinique",
"MR": "Mauritania",
"MU": "Mauritius",
"YT": "Mayotte",
"MX": "Mexico",
"FM": "Micronesia (Federated States of)",
"MD": "Moldova (Republic of)",
"MC": "Monaco",
"MN": "Mongolia",
"ME": "Montenegro",
"MS": "Montserrat",
"MA": "Morocco",
"MZ": "Mozambique",
"MM": "Myanmar",
"NA": "Namibia",
"NR": "Nauru",
"NP": "Nepal",
"NL": "Netherlands",
"NC": "New Caledonia",
"NZ": "New Zealand",
"NI": "Nicaragua",
"NE": "Niger",
"NG": "Nigeria",
"NU": "Niue",
"NF": "Norfolk Island",
"MP": "Northern Mariana Islands",
"NO": "Norway",
"OM": "Oman",
"PK": "Pakistan",
"PW": "Palau",
"PS": "Palestine, State of",
"PA": "Panama",
"PG": "Papua New Guinea",
"PY": "Paraguay",
"PE": "Peru",
"PH": "Philippines",
"PN": "Pitcairn",
"PL": "Poland",
"PT": "Portugal",
"PR": "Puerto Rico",
"QA": "Qatar",
"RE": "Réunion",
"RO": "Romania",
"RU": "Russian Federation",
"RW": "Rwanda",
"BL": "Saint Barthélemy",
"SH": "Saint Helena, Ascension and Tristan da Cunha",
"KN": "Saint Kitts and Nevis",
"LC": "Saint Lucia",
"MF": "Saint Martin (French part)",
"PM": "Saint Pierre and Miquelon",
"VC": "Saint Vincent and the Grenadines",
"WS": "Samoa",
"SM": "San Marino",
"ST": "Sao Tome and Principe",
"SA": "Saudi Arabia",
"SN": "Senegal",
"RS": "Serbia",
"SC": "Seychelles",
"SL": "Sierra Leone",
"SG": "Singapore",
"SX": "Sint Maarten (Dutch part)",
"SK": "Slovakia",
"SI": "Slovenia",
"SB": "Solomon Islands",
"SO": "Somalia",
"ZA": "South Africa",
"GS": "South Georgia and the South Sandwich Islands",
"SS": "South Sudan",
"ES": "Spain",
"LK": "Sri Lanka",
"SD": "Sudan",
"SR": "Suriname",
"SJ": "Svalbard and Jan Mayen",
"SE": "Sweden",
"CH": "Switzerland",
"SY": "Syrian Arab Republic",
"TW": "Taiwan, Province of China",
"TJ": "Tajikistan",
"TZ": "Tanzania, United Republic of",
"TH": "Thailand",
"TL": "Timor-Leste",
"TG": "Togo",
"TK": "Tokelau",
"TO": "Tonga",
"TT": "Trinidad and Tobago",
"TN": "Tunisia",
"TR": "Turkey",
"TM": "Turkmenistan",
"TC": "Turks and Caicos Islands",
"TV": "Tuvalu",
"UG": "Uganda",
"UA": "Ukraine",
"AE": "United Arab Emirates",
"GB": "United Kingdom of Great Britain and Northern Ireland",
"UM": "United States Minor Outlying Islands",
"US": "United States of America",
"UY": "Uruguay",
"UZ": "Uzbekistan",
"VU": "Vanuatu",
"VE": "Venezuela (Bolivarian Republic of)",
"VN": "Vietnam",
"VG": "Virgin Islands (British)",
"VI": "Virgin Islands (U.S.)",
"WF": "Wallis and Futuna",
"EH": "Western Sahara",
"YE": "Yemen",
"ZM": "Zambia",
"ZW": "Zimbabwe"
};
var chi = {
"AX": "奧蘭群島",
"AF": "阿富汗",
"AL": "阿爾巴尼亞",
"DZ": "阿爾及利亞",
"AS": "美屬薩摩亞",
"AD": "安道爾",
"AO": "安哥拉",
"AI": "安圭拉",
"AQ": "南極洲",
"AG": "安地卡及巴布達",
"AR": "阿根廷",
"AM": "亞美尼亞",
"AW": "阿魯巴",
"AU": "澳大利亞",
"AT": "奧地利",
"AZ": "阿塞拜疆",
"BS": "巴哈馬",
"BH": "巴林",
"BD": "孟加拉國",
"BB": "巴巴多斯",
"BY": "白俄羅斯",
"BE": "比利時",
"BZ": "伯利茲",
"BJ": "貝寧",
"BM": "百慕大",
"BT": "不丹",
"BO": "玻利維亞",
"BQ": "博奈爾島、聖尤斯達蒂斯和薩巴",
"BA": "波士尼亞和黑山共和國",
"BW": "博茨瓦納",
"BR": "巴西",
"IO": "英屬印度洋領地",
"VG": "英屬維爾京群島",
"BN": "文萊",
"BG": "保加利亞",
"BF": "布基納法索",
"BI": "布隆迪",
"KH": "柬埔寨",
"CM": "喀麥隆",
"CA": "加拿大",
"CV": "維德角",
"KY": "開曼群島",
"CF": "中非共和國",
"TD": "查德",
"CL": "智利",
"CN": "中華人民共和國",
"CX": "聖誕島",
"CC": "科科斯群島",
"CO": "哥倫比亞",
"KM": "科摩羅",
"CD": "薩伊",
"CK": "科克群島",
"CR": "哥斯達黎加",
"HR": "克羅地亞",
"CU": "古巴",
"CW": "庫拉索",
"CY": "塞浦路斯",
"CZ": "捷克共和國",
"DK": "丹麥",
"DJ": "吉布提",
"DM": "多明尼加",
"DM": "多米尼加",
"TL": "東帝汶",
"EC": "厄瓜多爾",
"EG": "埃及",
"SV": "薩爾瓦多",
"GQ": "赤道幾內亞",
"ER": "厄立特里亞",
"EE": "愛沙尼亞",
"ET": "埃塞俄比亞",
"FK": "福克蘭群島",
"FO": "法羅群島",
"FM": "密克羅尼西亞",
"FJ": "斐濟",
"FI": "芬蘭",
"FR": "法國",
"GF": "法屬圭亞那",
"PF": "法屬波利尼西亞",
"TF": "法屬南部領土",
"GA": "加蓬",
"GM": "岡比亞",
"GE": "格魯吉亞",
"DE": "德國",
"GH": "加納",
"GI": "直布羅陀",
"GR": "希臘",
"GL": "格陵蘭",
"GD": "格林納達",
"GP": "瓜德羅普島",
"GU": "關島",
"GT": "危地馬拉",
"GG": "格恩西島",
"GN": "幾內亞",
"GW": "幾內亞比紹",
"GY": "圭亞那",
"HT": "海地",
"JO": "約旦",
"HN": "洪都拉斯",
"HK": "中華人民共和國 (香港)",
"HU": "匈牙利",
"IS": "冰島",
"IN": "印度",
"ID": "印度尼西亞",
"IR": "伊朗",
"IQ": "伊拉克",
"IE": "愛爾蘭",
"IM": "曼島",
"IL": "以色列",
"IT": "意大利",
"CI": "科特迪瓦",
"JM": "牙買加",
"JP": "日本",
"JE": "澤西島",
"KZ": "哈薩克斯坦",
"KE": "肯尼亞",
"KI": "I-基里巴斯",
"XK": "科索沃",
"KW": "科威特",
"KG": "吉爾吉斯",
"LA": "老撾國",
"LV": "拉脫維亞",
"LB": "黎巴嫩",
"LS": "巴蘇陀",
"LR": "利比里亞",
"LY": "利比亞",
"LI": "列支敦士登",
"LU": "盧森堡",
"MO": "澳門",
"MK": "馬其頓",
"MG": "馬爾加什",
"MW": "馬拉維",
"MY": "馬來西亞",
"MV": "馬爾代夫",
"ML": "馬里",
"MT": "馬耳他",
"MH": "馬歇爾",
"MQ": "法屬馬丁尼克群島",
"MR": "毛里塔尼亞",
"MU": "毛里求斯",
"YT": "馬約特",
"MX": "墨西哥",
"MC": "摩納哥",
"MN": "蒙古",
"ME": "黑山共和國",
"MS": "蒙塞拉特群島",
"MA": "摩洛哥",
"MZ": "莫桑比克",
"MM": "緬甸",
"NA": "納米比亞",
"NR": "瑙魯",
"NP": "尼泊爾",
"NL": "荷蘭",
"NC": "新赫里多尼亞",
"NZ": "新西蘭",
"NI": "尼加拉瓜",
"NE": "尼日爾",
"NG": "尼日利亞",
"NU": "紐埃",
"NF": "諾福克島",
"KP": "北韓 (朝鮮民主人民共和國)",
"MP": "北馬里安納群島",
"NO": "挪威",
"OM": "阿曼",
"PK": "巴基斯坦",
"PW": "帕勞",
"PS": "巴勒斯坦領土",
"PA": "巴拿馬",
"PG": "巴布亞新幾內亞",
"PY": "巴拉圭",
"PE": "秘魯",
"PH": "菲律賓",
"PN": "皮特凱恩群島",
"PL": "波蘭",
"PT": "葡萄牙",
"PR": "波多黎各",
"QA": "卡塔爾",
"KR": "南韓 (大韓民國)",
"LT": "立陶宛",
"MD": "摩爾多瓦",
"CG": "剛果",
"RE": "留尼旺",
"RO": "羅馬尼亞",
"RU": "俄羅斯",
"RW": "盧旺達",
"SH": "聖赫勒拿",
"KN": "聖基茨和尼維斯",
"LC": "聖盧西安",
"MF": "聖馬丁",
"PM": "聖皮爾和密克隆",
"VC": "聖文森特和格林納丁斯群島",
"BL": "聖巴泰勒米",
"WS": "薩摩亞",
"SM": "聖馬力諾",
"ST": "聖多美",
"SA": "沙烏地阿拉伯",
"SN": "塞內加爾",
"RS": "塞爾維亞",
"SC": "塞舌爾",
"SL": "塞拉利昂",
"SG": "新加坡",
"MF": "聖馬丁島",
"SK": "斯洛伐克",
"SI": "斯洛文尼亞",
"SB": "所羅門群島",
"SO": "索馬里",
"ZA": "南非",
"GS": "南喬治亞島和南桑威齊群島",
"SS": "南蘇丹",
"ES": "西班牙",
"LK": "斯里蘭卡",
"SD": "蘇丹",
"SR": "蘇里南",
"SJ": "斯瓦爾巴特和揚馬延",
"SZ": "斯威士",
"SE": "瑞典",
"CH": "瑞士",
"SY": "敘利亞",
"TW": "台灣",
"TJ": "塔吉克",
"TZ": "坦桑尼亞",
"TH": "泰國",
"TG": "多哥",
"TK": "托克勞",
"TO": "湯加",
"TT": "千里達及多巴哥",
"TN": "突尼斯",
"TR": "土耳其",
"TM": "土庫曼斯坦",
"TC": "特克斯和凱科斯群島",
"TV": "圖瓦盧",
"UM": "美國邊遠小島",
"VI": "美屬維爾京群島",
"UG": "烏干達",
"UA": "烏克蘭",
"AE": "阿聯酋",
"GB": "英國",
"US": "美國",
"UY": "烏拉圭",
"UZ": "烏茲別克斯坦",
"VU": "瓦努阿圖",
"VA": "聖座(梵蒂岡)",
"VE": "委內瑞拉",
"VN": "越南",
"WF": "瓦利斯和富圖納",
"YE": "也門",
"ZM": "贊比亞",
"ZW": "津巴布韋"
};
let output = [];
const fs = require('fs')
const storeData = (data, path) => {
try {
fs.writeFileSync(path, JSON.stringify(data))
} catch (err) {
console.error(err)
}
}
Object.keys(jay).forEach(function (key) {
const iso = key;
const label = jay[key];
const chiLabel = jay[key]+'/'+chi[key];
output.push({
//label: chiLabel,
label: label,
iso: iso,
value: label
})
});
storeData(output, "output.json");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment