在 Zapier 中使用 Javascript 代码到 return 两个字母的 ISO 国家代码
Using Javascript Code in Zapier to return Two Letter ISO Country Code
我有一个正常运行的 Zapier 电子邮件解析器,它提供了一个国家/地区名称,我需要将其作为两个字母的国家/地区代码作为潜在客户的一部分提交到 Salesforce。
根据我正在阅读的内容,这应该可以使用 Zapier 的代码功能,并且 Javascript。
我发现 javascript 代码似乎在其他情况下也能正常工作,但我不熟悉 Javascript 无法进一步解决此问题。
当我运行使用输入“name”作为解析国家时,它给出了一个错误SyntaxError: Unexpected template string
Screenshot - Zapier Setup
Screenshot - Zapier Error
const isoCountries = {
'AF' : {
name: 'Afghanistan',
},
'AX' : {
name: 'Aland Islands',
},
'AL' : {
name: 'Albania',
},
'DZ' : {
name: 'Algeria',
},
'AS' : {
name: 'American Samoa',
},
'AD' : {
name: 'Andorra',
},
'AO' : {
name: 'Angola',
},
'AI' : {
name: 'Anguilla',
},
'AQ' : {
name: 'Antarctica',
},
'AG' : {
name: 'Antigua And Barbuda',
},
'AR' : {
name: 'Argentina',
},
'AM' : {
name: 'Armenia',
},
'AW' : {
name: 'Aruba',
},
'AU' : {
name: 'Australia',
},
'AT' : {
name: 'Austria',
},
'AZ' : {
name: 'Azerbaijan',
},
'BS' : {
name: 'Bahamas',
},
'BH' : {
name: 'Bahrain',
},
'BD' : {
name: 'Bangladesh',
},
'BB' : {
name: 'Barbados',
},
'BY' : {
name: 'Belarus',
},
'BE' : {
name: 'Belgium',
},
'BZ' : {
name: 'Belize',
},
'BJ' : {
name: 'Benin',
},
'BM' : {
name: 'Bermuda',
},
'BT' : {
name: 'Bhutan',
},
'BO' : {
name: 'Bolivia',
},
'BA' : {
name: 'Bosnia And Herzegovina',
},
'BW' : {
name: 'Botswana',
},
'BV' : {
name: 'Bouvet Island',
},
'BR' : {
name: 'Brazil',
},
'IO' : {
name: 'British Indian Ocean Territory',
},
'BN' : {
name: 'Brunei Darussalam',
},
'BG' : {
name: 'Bulgaria',
},
'BF' : {
name: 'Burkina Faso',
},
'BI' : {
name: 'Burundi',
},
'KH' : {
name: 'Cambodia',
},
'CM' : {
name: 'Cameroon',
},
'CA' : {
name: 'Canada',
},
'CV' : {
name: 'Cape Verde',
},
'KY' : {
name: 'Cayman Islands',
},
'CF' : {
name: 'Central African Republic',
},
'TD' : {
name: 'Chad',
},
'CL' : {
name: 'Chile',
},
'CN' : {
name: 'China',
},
'CX' : {
name: 'Christmas Island',
},
'CC' : {
name: 'Cocos (Keeling) Islands',
},
'CO' : {
name: 'Colombia',
},
'KM' : {
name: 'Comoros',
},
'CG' : {
name: 'Congo',
},
'CD' : {
name: 'Congo, Democratic Republic',
},
'CK' : {
name: 'Cook Islands',
},
'CR' : {
name: 'Costa Rica',
},
'CI' : {
name: 'Cote D\'Ivoire',
},
'HR' : {
name: 'Croatia',
},
'CU' : {
name: 'Cuba',
},
'CY' : {
name: 'Cyprus',
},
'CZ' : {
name: 'Czech Republic',
},
'DK' : {
name: 'Denmark',
},
'DJ' : {
name: 'Djibouti',
},
'DM' : {
name: 'Dominica',
},
'DO' : {
name: 'Dominican Republic',
},
'EC' : {
name: 'Ecuador',
},
'EG' : {
name: 'Egypt',
},
'SV' : {
name: 'El Salvador',
},
'GQ' : {
name: 'Equatorial Guinea',
},
'ER' : {
name: 'Eritrea',
},
'EE' : {
name: 'Estonia',
},
'ET' : {
name: 'Ethiopia',
},
'FK' : {
name: 'Falkland Islands (Malvinas)',
},
'FO' : {
name: 'Faroe Islands',
},
'FJ' : {
name: 'Fiji',
},
'FI' : {
name: 'Finland',
},
'FR' : {
name: 'France',
},
'GF' : {
name: 'French Guiana',
},
'PF' : {
name: 'French Polynesia',
},
'TF' : {
name: 'French Southern Territories',
},
'GA' : {
name: 'Gabon',
},
'GM' : {
name: 'Gambia',
},
'GE' : {
name: 'Georgia',
},
'DE' : {
name: 'Germany',
},
'GH' : {
name: 'Ghana',
},
'GI' : {
name: 'Gibraltar',
},
'GR' : {
name: 'Greece',
},
'GL' : {
name: 'Greenland',
},
'GD' : {
name: 'Grenada',
},
'GP' : {
name: 'Guadeloupe',
},
'GU' : {
name: 'Guam',
},
'GT' : {
name: 'Guatemala',
},
'GG' : {
name: 'Guernsey',
},
'GN' : {
name: 'Guinea',
},
'GW' : {
name: 'Guinea-Bissau',
},
'GY' : {
name: 'Guyana',
},
'HT' : {
name: 'Haiti',
},
'HM' : {
name: 'Heard Island & Mcdonald Islands',
},
'VA' : {
name: 'Holy See (Vatican City State)',
},
'HN' : {
name: 'Honduras',
},
'HK' : {
name: 'Hong Kong',
},
'HU' : {
name: 'Hungary',
},
'IS' : {
name: 'Iceland',
},
'IN' : {
name: 'India',
},
'ID' : {
name: 'Indonesia',
},
'IR' : {
name: 'Iran, Islamic Republic Of',
},
'IQ' : {
name: 'Iraq',
},
'IE' : {
name: 'Ireland',
},
'IM' : {
name: 'Isle Of Man',
},
'IL' : {
name: 'Israel',
},
'IT' : {
name: 'Italy',
},
'JM' : {
name: 'Jamaica',
},
'JP' : {
name: 'Japan',
},
'JE' : {
name: 'Jersey',
},
'JO' : {
name: 'Jordan',
},
'KZ' : {
name: 'Kazakhstan',
},
'KE' : {
name: 'Kenya',
},
'KI' : {
name: 'Kiribati',
},
'KR' : {
name: 'Korea',
},
'KW' : {
name: 'Kuwait',
},
'KG' : {
name: 'Kyrgyzstan',
},
'LA' : {
name: 'Lao People\'s Democratic Republic',
},
'LV' : {
name: 'Latvia',
},
'LB' : {
name: 'Lebanon',
},
'LS' : {
name: 'Lesotho',
},
'LR' : {
name: 'Liberia',
},
'LY' : {
name: 'Libyan Arab Jamahiriya',
},
'LI' : {
name: 'Liechtenstein',
},
'LT' : {
name: 'Lithuania',
},
'LU' : {
name: 'Luxembourg',
},
'MO' : {
name: 'Macao',
},
'MK' : {
name: 'Macedonia',
},
'MG' : {
name: 'Madagascar',
},
'MW' : {
name: 'Malawi',
},
'MY' : {
name: 'Malaysia',
},
'MV' : {
name: 'Maldives',
},
'ML' : {
name: 'Mali',
},
'MT' : {
name: 'Malta',
},
'MH' : {
name: 'Marshall Islands',
},
'MQ' : {
name: 'Martinique',
},
'MR' : {
name: 'Mauritania',
},
'MU' : {
name: 'Mauritius',
},
'YT' : {
name: 'Mayotte',
},
'MX' : {
name: 'Mexico',
},
'FM' : {
name: 'Micronesia, Federated States Of',
},
'MD' : {
name: 'Moldova',
},
'MC' : {
name: 'Monaco',
},
'MN' : {
name: 'Mongolia',
},
'ME' : {
name: 'Montenegro',
},
'MS' : {
name: 'Montserrat',
},
'MA' : {
name: 'Morocco',
},
'MZ' : {
name: 'Mozambique',
},
'MM' : {
name: 'Myanmar',
},
'NA' : {
name: 'Namibia',
},
'NR' : {
name: 'Nauru',
},
'NP' : {
name: 'Nepal',
},
'NL' : {
name: 'Netherlands',
},
'AN' : {
name: 'Netherlands Antilles',
},
'NC' : {
name: 'New Caledonia',
},
'NZ' : {
name: 'New Zealand',
},
'NI' : {
name: 'Nicaragua',
},
'NE' : {
name: 'Niger',
},
'NG' : {
name: 'Nigeria',
},
'NU' : {
name: 'Niue',
},
'NF' : {
name: 'Norfolk Island',
},
'MP' : {
name: 'Northern Mariana Islands',
},
'NO' : {
name: 'Norway',
},
'OM' : {
name: 'Oman',
},
'PK' : {
name: 'Pakistan',
},
'PW' : {
name: 'Palau',
},
'PS' : {
name: 'Palestinian Territory, Occupied',
},
'PA' : {
name: 'Panama',
},
'PG' : {
name: 'Papua New Guinea',
},
'PY' : {
name: 'Paraguay',
},
'PE' : {
name: 'Peru',
},
'PH' : {
name: 'Philippines',
},
'PN' : {
name: 'Pitcairn',
},
'PL' : {
name: 'Poland',
},
'PT' : {
name: 'Portugal',
},
'PR' : {
name: 'Puerto Rico',
},
'QA' : {
name: 'Qatar',
},
'RE' : {
name: 'Reunion',
},
'RO' : {
name: 'Romania',
},
'RU' : {
name: 'Russian Federation',
},
'RW' : {
name: 'Rwanda',
},
'BL' : {
name: 'Saint Barthelemy',
},
'SH' : {
name: 'Saint Helena',
},
'KN' : {
name: 'Saint Kitts And Nevis',
},
'LC' : {
name: 'Saint Lucia',
},
'MF' : {
name: 'Saint Martin',
},
'PM' : {
name: 'Saint Pierre And Miquelon',
},
'VC' : {
name: 'Saint Vincent And Grenadines',
},
'WS' : {
name: 'Samoa',
},
'SM' : {
name: 'San Marino',
},
'ST' : {
name: 'Sao Tome And Principe',
},
'SA' : {
name: 'Saudi Arabia',
},
'SN' : {
name: 'Senegal',
},
'RS' : {
name: 'Serbia',
},
'SC' : {
name: 'Seychelles',
},
'SL' : {
name: 'Sierra Leone',
},
'SG' : {
name: 'Singapore',
},
'SK' : {
name: 'Slovakia',
},
'SI' : {
name: 'Slovenia',
},
'SB' : {
name: 'Solomon Islands',
},
'SO' : {
name: 'Somalia',
},
'ZA' : {
name: 'South Africa',
},
'GS' : {
name: 'South Georgia And Sandwich Isl.',
},
'ES' : {
name: 'Spain',
},
'LK' : {
name: 'Sri Lanka',
},
'SD' : {
name: 'Sudan',
},
'SR' : {
name: 'Suriname',
},
'SJ' : {
name: 'Svalbard And Jan Mayen',
},
'SZ' : {
name: 'Swaziland',
},
'SE' : {
name: 'Sweden',
},
'CH' : {
name: 'Switzerland',
},
'SY' : {
name: 'Syrian Arab Republic',
},
'TW' : {
name: 'Taiwan',
},
'TJ' : {
name: 'Tajikistan',
},
'TZ' : {
name: 'Tanzania',
},
'TH' : {
name: 'Thailand',
},
'TL' : {
name: 'Timor-Leste',
},
'TG' : {
name: 'Togo',
},
'TK' : {
name: 'Tokelau',
},
'TO' : {
name: 'Tonga',
},
'TT' : {
name: 'Trinidad And Tobago',
},
'TN' : {
name: 'Tunisia',
},
'TR' : {
name: 'Turkey',
},
'TM' : {
name: 'Turkmenistan',
},
'TC' : {
name: 'Turks And Caicos Islands',
},
'TV' : {
name: 'Tuvalu',
},
'UG' : {
name: 'Uganda',
},
'UA' : {
name: 'Ukraine',
},
'AE' : {
name: 'United Arab Emirates',
},
'GB' : {
name: 'United Kingdom',
},
'US' : {
name: 'United States',
},
'UM' : {
name: 'United States Outlying Islands',
},
'UY' : {
name: 'Uruguay',
},
'UZ' : {
name: 'Uzbekistan',
},
'VU' : {
name: 'Vanuatu',
},
'VE' : {
name: 'Venezuela',
},
'VN' : {
name: 'Viet Nam',
},
'VG' : {
name: 'Virgin Islands, British',
},
'VI' : {
name: 'Virgin Islands, U.S.',
},
'WF' : {
name: 'Wallis And Futuna',
},
'EH' : {
name: 'Western Sahara',
},
'YE' : {
name: 'Yemen',
},
'ZM' : {
name: 'Zambia',
},
'ZW' : {
name: 'Zimbabwe'
},
};
convertCountryCode = (code) => {
return isoCountries[code].name;
}```
我绝不是 javascript 专家,但我是 Zapier 的超级粉丝。我稍微修改了您的代码,认为这应该可行。
/* jshint esversion: 6 */
const isoCountries = [
{
code: 'AF',
name: 'Afghanistan'
},
{
code: 'AX',
name: 'Aland Islands'
},
{
code: 'AL',
name: 'Albania'
},
{
code: 'DZ',
name: 'Algeria'
},
{
code: 'AS',
name: 'American Samoa'
},
{
code: 'AD',
name: 'Andorra'
},
{
code: 'AO',
name: 'Angola'
},
{
code: 'AI',
name: 'Anguilla'
},
{
code: 'AQ',
name: 'Antarctica'
},
{
code: 'AG',
name: 'Antigua And Barbuda'
},
{
code: 'AR',
name: 'Argentina'
},
{
code: 'AM',
name: 'Armenia'
},
{
code: 'AW',
name: 'Aruba'
},
{
code: 'AU',
name: 'Australia'
},
{
code: 'AT',
name: 'Austria'
},
{
code: 'AZ',
name: 'Azerbaijan'
},
{
code: 'BS',
name: 'Bahamas'
},
{
code: 'BH',
name: 'Bahrain'
},
{
code: 'BD',
name: 'Bangladesh'
},
{
code: 'BB',
name: 'Barbados'
},
{
code: 'BY',
name: 'Belarus'
},
{
code: 'BE',
name: 'Belgium'
},
{
code: 'BZ',
name: 'Belize'
},
{
code: 'BJ',
name: 'Benin'
},
{
code: 'BM',
name: 'Bermuda'
},
{
code: 'BT',
name: 'Bhutan'
},
{
code: 'BO',
name: 'Bolivia'
},
{
code: 'BA',
name: 'Bosnia And Herzegovina'
},
{
code: 'BW',
name: 'Botswana'
},
{
code: 'BV',
name: 'Bouvet Island'
},
{
code: 'BR',
name: 'Brazil'
},
{
code: 'IO',
name: 'British Indian Ocean Territory'
},
{
code: 'BN',
name: 'Brunei Darussalam'
},
{
code: 'BG',
name: 'Bulgaria'
},
{
code: 'BF',
name: 'Burkina Faso'
},
{
code: 'BI',
name: 'Burundi'
},
{
code: 'KH',
name: 'Cambodia'
},
{
code: 'CM',
name: 'Cameroon'
},
{
code: 'CA',
name: 'Canada'
},
{
code: 'CV',
name: 'Cape Verde'
},
{
code: 'KY',
name: 'Cayman Islands'
},
{
code: 'CF',
name: 'Central African Republic'
},
{
code: 'TD',
name: 'Chad'
},
{
code: 'CL',
name: 'Chile'
},
{
code: 'CN',
name: 'China'
},
{
code: 'CX',
name: 'Christmas Island'
},
{
code: 'CC',
name: 'Cocos (Keeling) Islands'
},
{
code: 'CO',
name: 'Colombia'
},
{
code: 'KM',
name: 'Comoros'
},
{
code: 'CG',
name: 'Congo'
},
{
code: 'CD',
name: 'Congo, Democratic Republic'
},
{
code: 'CK',
name: 'Cook Islands'
},
{
code: 'CR',
name: 'Costa Rica'
},
{
code: 'CI',
name: 'Cote D\'Ivoire'
},
{
code: 'HR',
name: 'Croatia'
},
{
code: 'CU',
name: 'Cuba'
},
{
code: 'CY',
name: 'Cyprus'
},
{
code: 'CZ',
name: 'Czech Republic'
},
{
code: 'DK',
name: 'Denmark'
},
{
code: 'DJ',
name: 'Djibouti'
},
{
code: 'DM',
name: 'Dominica'
},
{
code: 'DO',
name: 'Dominican Republic'
},
{
code: 'EC',
name: 'Ecuador'
},
{
code: 'EG',
name: 'Egypt'
},
{
code: 'SV',
name: 'El Salvador'
},
{
code: 'GQ',
name: 'Equatorial Guinea'
},
{
code: 'ER',
name: 'Eritrea'
},
{
code: 'EE',
name: 'Estonia'
},
{
code: 'ET',
name: 'Ethiopia'
},
{
code: 'FK',
name: 'Falkland Islands (Malvinas)'
},
{
code: 'FO',
name: 'Faroe Islands'
},
{
code: 'FJ',
name: 'Fiji'
},
{
code: 'FI',
name: 'Finland'
},
{
code: 'FR',
name: 'France'
},
{
code: 'GF',
name: 'French Guiana'
},
{
code: 'PF',
name: 'French Polynesia'
},
{
code: 'TF',
name: 'French Southern Territories'
},
{
code: 'GA',
name: 'Gabon'
},
{
code: 'GM',
name: 'Gambia'
},
{
code: 'GE',
name: 'Georgia'
},
{
code: 'DE',
name: 'Germany'
},
{
code: 'GH',
name: 'Ghana'
},
{
code: 'GI',
name: 'Gibraltar'
},
{
code: 'GR',
name: 'Greece'
},
{
code: 'GL',
name: 'Greenland'
},
{
code: 'GD',
name: 'Grenada'
},
{
code: 'GP',
name: 'Guadeloupe'
},
{
code: 'GU',
name: 'Guam'
},
{
code: 'GT',
name: 'Guatemala'
},
{
code: 'GG',
name: 'Guernsey'
},
{
code: 'GN',
name: 'Guinea'
},
{
code: 'GW',
name: 'Guinea-Bissau'
},
{
code: 'GY',
name: 'Guyana'
},
{
code: 'HT',
name: 'Haiti'
},
{
code: 'HM',
name: 'Heard Island & Mcdonald Islands'
},
{
code: 'VA',
name: 'Holy See (Vatican City State)'
},
{
code: 'HN',
name: 'Honduras'
},
{
code: 'HK',
name: 'Hong Kong'
},
{
code: 'HU',
name: 'Hungary'
},
{
code: 'IS',
name: 'Iceland'
},
{
code: 'IN',
name: 'India'
},
{
code: 'ID',
name: 'Indonesia'
},
{
code: 'IR',
name: 'Iran, Islamic Republic Of'
},
{
code: 'IQ',
name: 'Iraq'
},
{
code: 'IE',
name: 'Ireland'
},
{
code: 'IM',
name: 'Isle Of Man'
},
{
code: 'IL',
name: 'Israel'
},
{
code: 'IT',
name: 'Italy'
},
{
code: 'JM',
name: 'Jamaica'
},
{
code: 'JP',
name: 'Japan'
},
{
code: 'JE',
name: 'Jersey'
},
{
code: 'JO',
name: 'Jordan'
},
{
code: 'KZ',
name: 'Kazakhstan'
},
{
code: 'KE',
name: 'Kenya'
},
{
code: 'KI',
name: 'Kiribati'
},
{
code: 'KR',
name: 'Korea'
},
{
code: 'KW',
name: 'Kuwait'
},
{
code: 'KG',
name: 'Kyrgyzstan'
},
{
code: 'LA',
name: 'Lao People\'s Democratic Republic'
},
{
code: 'LV',
name: 'Latvia'
},
{
code: 'LB',
name: 'Lebanon'
},
{
code: 'LS',
name: 'Lesotho'
},
{
code: 'LR',
name: 'Liberia'
},
{
code: 'LY',
name: 'Libyan Arab Jamahiriya'
},
{
code: 'LI',
name: 'Liechtenstein'
},
{
code: 'LT',
name: 'Lithuania'
},
{
code: 'LU',
name: 'Luxembourg'
},
{
code: 'MO',
name: 'Macao'
},
{
code: 'MK',
name: 'Macedonia'
},
{
code: 'MG',
name: 'Madagascar'
},
{
code: 'MW',
name: 'Malawi'
},
{
code: 'MY',
name: 'Malaysia'
},
{
code: 'MV',
name: 'Maldives'
},
{
code: 'ML',
name: 'Mali'
},
{
code: 'MT',
name: 'Malta'
},
{
code: 'MH',
name: 'Marshall Islands'
},
{
code: 'MQ',
name: 'Martinique'
},
{
code: 'MR',
name: 'Mauritania'
},
{
code: 'MU',
name: 'Mauritius'
},
{
code: 'YT',
name: 'Mayotte'
},
{
code: 'MX',
name: 'Mexico'
},
{
code: 'FM',
name: 'Micronesia, Federated States Of'
},
{
code: 'MD',
name: 'Moldova'
},
{
code: 'MC',
name: 'Monaco'
},
{
code: 'MN',
name: 'Mongolia'
},
{
code: 'ME',
name: 'Montenegro'
},
{
code: 'MS',
name: 'Montserrat'
},
{
code: 'MA',
name: 'Morocco'
},
{
code: 'MZ',
name: 'Mozambique'
},
{
code: 'MM',
name: 'Myanmar'
},
{
code: 'NA',
name: 'Namibia'
},
{
code: 'NR',
name: 'Nauru'
},
{
code: 'NP',
name: 'Nepal'
},
{
code: 'NL',
name: 'Netherlands'
},
{
code: 'AN',
name: 'Netherlands Antilles'
},
{
code: 'NC',
name: 'New Caledonia'
},
{
code: 'NZ',
name: 'New Zealand'
},
{
code: 'NI',
name: 'Nicaragua'
},
{
code: 'NE',
name: 'Niger'
},
{
code: 'NG',
name: 'Nigeria'
},
{
code: 'NU',
name: 'Niue'
},
{
code: 'NF',
name: 'Norfolk Island'
},
{
code: 'MP',
name: 'Northern Mariana Islands'
},
{
code: 'NO',
name: 'Norway'
},
{
code: 'OM',
name: 'Oman'
},
{
code: 'PK',
name: 'Pakistan'
},
{
code: 'PW',
name: 'Palau'
},
{
code: 'PS',
name: 'Palestinian Territory, Occupied'
},
{
code: 'PA',
name: 'Panama'
},
{
code: 'PG',
name: 'Papua New Guinea'
},
{
code: 'PY',
name: 'Paraguay'
},
{
code: 'PE',
name: 'Peru'
},
{
code: 'PH',
name: 'Philippines'
},
{
code: 'PN',
name: 'Pitcairn'
},
{
code: 'PL',
name: 'Poland'
},
{
code: 'PT',
name: 'Portugal'
},
{
code: 'PR',
name: 'Puerto Rico'
},
{
code: 'QA',
name: 'Qatar'
},
{
code: 'RE',
name: 'Reunion'
},
{
code: 'RO',
name: 'Romania'
},
{
code: 'RU',
name: 'Russian Federation'
},
{
code: 'RW',
name: 'Rwanda'
},
{
code: 'BL',
name: 'Saint Barthelemy'
},
{
code: 'SH',
name: 'Saint Helena'
},
{
code: 'KN',
name: 'Saint Kitts And Nevis'
},
{
code: 'LC',
name: 'Saint Lucia'
},
{
code: 'MF',
name: 'Saint Martin'
},
{
code: 'PM',
name: 'Saint Pierre And Miquelon'
},
{
code: 'VC',
name: 'Saint Vincent And Grenadines'
},
{
code: 'WS',
name: 'Samoa'
},
{
code: 'SM',
name: 'San Marino'
},
{
code: 'ST',
name: 'Sao Tome And Principe'
},
{
code: 'SA',
name: 'Saudi Arabia'
},
{
code: 'SN',
name: 'Senegal'
},
{
code: 'RS',
name: 'Serbia'
},
{
code: 'SC',
name: 'Seychelles'
},
{
code: 'SL',
name: 'Sierra Leone'
},
{
code: 'SG',
name: 'Singapore'
},
{
code: 'SK',
name: 'Slovakia'
},
{
code: 'SI',
name: 'Slovenia'
},
{
code: 'SB',
name: 'Solomon Islands'
},
{
code: 'SO',
name: 'Somalia'
},
{
code: 'ZA',
name: 'South Africa'
},
{
code: 'GS',
name: 'South Georgia And Sandwich Isl.'
},
{
code: 'ES',
name: 'Spain'
},
{
code: 'LK',
name: 'Sri Lanka'
},
{
code: 'SD',
name: 'Sudan'
},
{
code: 'SR',
name: 'Suriname'
},
{
code: 'SJ',
name: 'Svalbard And Jan Mayen'
},
{
code: 'SZ',
name: 'Swaziland'
},
{
code: 'SE',
name: 'Sweden'
},
{
code: 'CH',
name: 'Switzerland'
},
{
code: 'SY',
name: 'Syrian Arab Republic'
},
{
code: 'TW',
name: 'Taiwan'
},
{
code: 'TJ',
name: 'Tajikistan'
},
{
code: 'TZ',
name: 'Tanzania'
},
{
code: 'TH',
name: 'Thailand'
},
{
code: 'TL',
name: 'Timor-Leste'
},
{
code: 'TG',
name: 'Togo'
},
{
code: 'TK',
name: 'Tokelau'
},
{
code: 'TO',
name: 'Tonga'
},
{
code: 'TT',
name: 'Trinidad And Tobago'
},
{
code: 'TN',
name: 'Tunisia'
},
{
code: 'TR',
name: 'Turkey'
},
{
code: 'TM',
name: 'Turkmenistan'
},
{
code: 'TC',
name: 'Turks And Caicos Islands'
},
{
code: 'TV',
name: 'Tuvalu'
},
{
code: 'UG',
name: 'Uganda'
},
{
code: 'UA',
name: 'Ukraine'
},
{
code: 'AE',
name: 'United Arab Emirates'
},
{
code: 'GB',
name: 'United Kingdom'
},
{
code: 'US',
name: 'United States'
},
{
code: 'UM',
name: 'United States Outlying Islands'
},
{
code: 'UY',
name: 'Uruguay'
},
{
code: 'UZ',
name: 'Uzbekistan'
},
{
code: 'VU',
name: 'Vanuatu'
},
{
code: 'VE',
name: 'Venezuela'
},
{
code: 'VN',
name: 'Viet Nam'
},
{
code: 'VG',
name: 'Virgin Islands, British'
},
{
code: 'VI',
name: 'Virgin Islands, U.S.'
},
{
code: 'WF',
name: 'Wallis And Futuna'
},
{
code: 'EH',
name: 'Western Sahara'
},
{
code: 'YE',
name: 'Yemen'
},
{
code: 'ZM',
name: 'Zambia'
},
{
code: 'ZW',
name: 'Zimbabwe'
}
];
return isoCountries.find(item => item.name === inputData.name);
我有一个正常运行的 Zapier 电子邮件解析器,它提供了一个国家/地区名称,我需要将其作为两个字母的国家/地区代码作为潜在客户的一部分提交到 Salesforce。
根据我正在阅读的内容,这应该可以使用 Zapier 的代码功能,并且 Javascript。
我发现 javascript 代码似乎在其他情况下也能正常工作,但我不熟悉 Javascript 无法进一步解决此问题。
当我运行使用输入“name”作为解析国家时,它给出了一个错误SyntaxError: Unexpected template string
Screenshot - Zapier Setup
Screenshot - Zapier Error
const isoCountries = {
'AF' : {
name: 'Afghanistan',
},
'AX' : {
name: 'Aland Islands',
},
'AL' : {
name: 'Albania',
},
'DZ' : {
name: 'Algeria',
},
'AS' : {
name: 'American Samoa',
},
'AD' : {
name: 'Andorra',
},
'AO' : {
name: 'Angola',
},
'AI' : {
name: 'Anguilla',
},
'AQ' : {
name: 'Antarctica',
},
'AG' : {
name: 'Antigua And Barbuda',
},
'AR' : {
name: 'Argentina',
},
'AM' : {
name: 'Armenia',
},
'AW' : {
name: 'Aruba',
},
'AU' : {
name: 'Australia',
},
'AT' : {
name: 'Austria',
},
'AZ' : {
name: 'Azerbaijan',
},
'BS' : {
name: 'Bahamas',
},
'BH' : {
name: 'Bahrain',
},
'BD' : {
name: 'Bangladesh',
},
'BB' : {
name: 'Barbados',
},
'BY' : {
name: 'Belarus',
},
'BE' : {
name: 'Belgium',
},
'BZ' : {
name: 'Belize',
},
'BJ' : {
name: 'Benin',
},
'BM' : {
name: 'Bermuda',
},
'BT' : {
name: 'Bhutan',
},
'BO' : {
name: 'Bolivia',
},
'BA' : {
name: 'Bosnia And Herzegovina',
},
'BW' : {
name: 'Botswana',
},
'BV' : {
name: 'Bouvet Island',
},
'BR' : {
name: 'Brazil',
},
'IO' : {
name: 'British Indian Ocean Territory',
},
'BN' : {
name: 'Brunei Darussalam',
},
'BG' : {
name: 'Bulgaria',
},
'BF' : {
name: 'Burkina Faso',
},
'BI' : {
name: 'Burundi',
},
'KH' : {
name: 'Cambodia',
},
'CM' : {
name: 'Cameroon',
},
'CA' : {
name: 'Canada',
},
'CV' : {
name: 'Cape Verde',
},
'KY' : {
name: 'Cayman Islands',
},
'CF' : {
name: 'Central African Republic',
},
'TD' : {
name: 'Chad',
},
'CL' : {
name: 'Chile',
},
'CN' : {
name: 'China',
},
'CX' : {
name: 'Christmas Island',
},
'CC' : {
name: 'Cocos (Keeling) Islands',
},
'CO' : {
name: 'Colombia',
},
'KM' : {
name: 'Comoros',
},
'CG' : {
name: 'Congo',
},
'CD' : {
name: 'Congo, Democratic Republic',
},
'CK' : {
name: 'Cook Islands',
},
'CR' : {
name: 'Costa Rica',
},
'CI' : {
name: 'Cote D\'Ivoire',
},
'HR' : {
name: 'Croatia',
},
'CU' : {
name: 'Cuba',
},
'CY' : {
name: 'Cyprus',
},
'CZ' : {
name: 'Czech Republic',
},
'DK' : {
name: 'Denmark',
},
'DJ' : {
name: 'Djibouti',
},
'DM' : {
name: 'Dominica',
},
'DO' : {
name: 'Dominican Republic',
},
'EC' : {
name: 'Ecuador',
},
'EG' : {
name: 'Egypt',
},
'SV' : {
name: 'El Salvador',
},
'GQ' : {
name: 'Equatorial Guinea',
},
'ER' : {
name: 'Eritrea',
},
'EE' : {
name: 'Estonia',
},
'ET' : {
name: 'Ethiopia',
},
'FK' : {
name: 'Falkland Islands (Malvinas)',
},
'FO' : {
name: 'Faroe Islands',
},
'FJ' : {
name: 'Fiji',
},
'FI' : {
name: 'Finland',
},
'FR' : {
name: 'France',
},
'GF' : {
name: 'French Guiana',
},
'PF' : {
name: 'French Polynesia',
},
'TF' : {
name: 'French Southern Territories',
},
'GA' : {
name: 'Gabon',
},
'GM' : {
name: 'Gambia',
},
'GE' : {
name: 'Georgia',
},
'DE' : {
name: 'Germany',
},
'GH' : {
name: 'Ghana',
},
'GI' : {
name: 'Gibraltar',
},
'GR' : {
name: 'Greece',
},
'GL' : {
name: 'Greenland',
},
'GD' : {
name: 'Grenada',
},
'GP' : {
name: 'Guadeloupe',
},
'GU' : {
name: 'Guam',
},
'GT' : {
name: 'Guatemala',
},
'GG' : {
name: 'Guernsey',
},
'GN' : {
name: 'Guinea',
},
'GW' : {
name: 'Guinea-Bissau',
},
'GY' : {
name: 'Guyana',
},
'HT' : {
name: 'Haiti',
},
'HM' : {
name: 'Heard Island & Mcdonald Islands',
},
'VA' : {
name: 'Holy See (Vatican City State)',
},
'HN' : {
name: 'Honduras',
},
'HK' : {
name: 'Hong Kong',
},
'HU' : {
name: 'Hungary',
},
'IS' : {
name: 'Iceland',
},
'IN' : {
name: 'India',
},
'ID' : {
name: 'Indonesia',
},
'IR' : {
name: 'Iran, Islamic Republic Of',
},
'IQ' : {
name: 'Iraq',
},
'IE' : {
name: 'Ireland',
},
'IM' : {
name: 'Isle Of Man',
},
'IL' : {
name: 'Israel',
},
'IT' : {
name: 'Italy',
},
'JM' : {
name: 'Jamaica',
},
'JP' : {
name: 'Japan',
},
'JE' : {
name: 'Jersey',
},
'JO' : {
name: 'Jordan',
},
'KZ' : {
name: 'Kazakhstan',
},
'KE' : {
name: 'Kenya',
},
'KI' : {
name: 'Kiribati',
},
'KR' : {
name: 'Korea',
},
'KW' : {
name: 'Kuwait',
},
'KG' : {
name: 'Kyrgyzstan',
},
'LA' : {
name: 'Lao People\'s Democratic Republic',
},
'LV' : {
name: 'Latvia',
},
'LB' : {
name: 'Lebanon',
},
'LS' : {
name: 'Lesotho',
},
'LR' : {
name: 'Liberia',
},
'LY' : {
name: 'Libyan Arab Jamahiriya',
},
'LI' : {
name: 'Liechtenstein',
},
'LT' : {
name: 'Lithuania',
},
'LU' : {
name: 'Luxembourg',
},
'MO' : {
name: 'Macao',
},
'MK' : {
name: 'Macedonia',
},
'MG' : {
name: 'Madagascar',
},
'MW' : {
name: 'Malawi',
},
'MY' : {
name: 'Malaysia',
},
'MV' : {
name: 'Maldives',
},
'ML' : {
name: 'Mali',
},
'MT' : {
name: 'Malta',
},
'MH' : {
name: 'Marshall Islands',
},
'MQ' : {
name: 'Martinique',
},
'MR' : {
name: 'Mauritania',
},
'MU' : {
name: 'Mauritius',
},
'YT' : {
name: 'Mayotte',
},
'MX' : {
name: 'Mexico',
},
'FM' : {
name: 'Micronesia, Federated States Of',
},
'MD' : {
name: 'Moldova',
},
'MC' : {
name: 'Monaco',
},
'MN' : {
name: 'Mongolia',
},
'ME' : {
name: 'Montenegro',
},
'MS' : {
name: 'Montserrat',
},
'MA' : {
name: 'Morocco',
},
'MZ' : {
name: 'Mozambique',
},
'MM' : {
name: 'Myanmar',
},
'NA' : {
name: 'Namibia',
},
'NR' : {
name: 'Nauru',
},
'NP' : {
name: 'Nepal',
},
'NL' : {
name: 'Netherlands',
},
'AN' : {
name: 'Netherlands Antilles',
},
'NC' : {
name: 'New Caledonia',
},
'NZ' : {
name: 'New Zealand',
},
'NI' : {
name: 'Nicaragua',
},
'NE' : {
name: 'Niger',
},
'NG' : {
name: 'Nigeria',
},
'NU' : {
name: 'Niue',
},
'NF' : {
name: 'Norfolk Island',
},
'MP' : {
name: 'Northern Mariana Islands',
},
'NO' : {
name: 'Norway',
},
'OM' : {
name: 'Oman',
},
'PK' : {
name: 'Pakistan',
},
'PW' : {
name: 'Palau',
},
'PS' : {
name: 'Palestinian Territory, Occupied',
},
'PA' : {
name: 'Panama',
},
'PG' : {
name: 'Papua New Guinea',
},
'PY' : {
name: 'Paraguay',
},
'PE' : {
name: 'Peru',
},
'PH' : {
name: 'Philippines',
},
'PN' : {
name: 'Pitcairn',
},
'PL' : {
name: 'Poland',
},
'PT' : {
name: 'Portugal',
},
'PR' : {
name: 'Puerto Rico',
},
'QA' : {
name: 'Qatar',
},
'RE' : {
name: 'Reunion',
},
'RO' : {
name: 'Romania',
},
'RU' : {
name: 'Russian Federation',
},
'RW' : {
name: 'Rwanda',
},
'BL' : {
name: 'Saint Barthelemy',
},
'SH' : {
name: 'Saint Helena',
},
'KN' : {
name: 'Saint Kitts And Nevis',
},
'LC' : {
name: 'Saint Lucia',
},
'MF' : {
name: 'Saint Martin',
},
'PM' : {
name: 'Saint Pierre And Miquelon',
},
'VC' : {
name: 'Saint Vincent And Grenadines',
},
'WS' : {
name: 'Samoa',
},
'SM' : {
name: 'San Marino',
},
'ST' : {
name: 'Sao Tome And Principe',
},
'SA' : {
name: 'Saudi Arabia',
},
'SN' : {
name: 'Senegal',
},
'RS' : {
name: 'Serbia',
},
'SC' : {
name: 'Seychelles',
},
'SL' : {
name: 'Sierra Leone',
},
'SG' : {
name: 'Singapore',
},
'SK' : {
name: 'Slovakia',
},
'SI' : {
name: 'Slovenia',
},
'SB' : {
name: 'Solomon Islands',
},
'SO' : {
name: 'Somalia',
},
'ZA' : {
name: 'South Africa',
},
'GS' : {
name: 'South Georgia And Sandwich Isl.',
},
'ES' : {
name: 'Spain',
},
'LK' : {
name: 'Sri Lanka',
},
'SD' : {
name: 'Sudan',
},
'SR' : {
name: 'Suriname',
},
'SJ' : {
name: 'Svalbard And Jan Mayen',
},
'SZ' : {
name: 'Swaziland',
},
'SE' : {
name: 'Sweden',
},
'CH' : {
name: 'Switzerland',
},
'SY' : {
name: 'Syrian Arab Republic',
},
'TW' : {
name: 'Taiwan',
},
'TJ' : {
name: 'Tajikistan',
},
'TZ' : {
name: 'Tanzania',
},
'TH' : {
name: 'Thailand',
},
'TL' : {
name: 'Timor-Leste',
},
'TG' : {
name: 'Togo',
},
'TK' : {
name: 'Tokelau',
},
'TO' : {
name: 'Tonga',
},
'TT' : {
name: 'Trinidad And Tobago',
},
'TN' : {
name: 'Tunisia',
},
'TR' : {
name: 'Turkey',
},
'TM' : {
name: 'Turkmenistan',
},
'TC' : {
name: 'Turks And Caicos Islands',
},
'TV' : {
name: 'Tuvalu',
},
'UG' : {
name: 'Uganda',
},
'UA' : {
name: 'Ukraine',
},
'AE' : {
name: 'United Arab Emirates',
},
'GB' : {
name: 'United Kingdom',
},
'US' : {
name: 'United States',
},
'UM' : {
name: 'United States Outlying Islands',
},
'UY' : {
name: 'Uruguay',
},
'UZ' : {
name: 'Uzbekistan',
},
'VU' : {
name: 'Vanuatu',
},
'VE' : {
name: 'Venezuela',
},
'VN' : {
name: 'Viet Nam',
},
'VG' : {
name: 'Virgin Islands, British',
},
'VI' : {
name: 'Virgin Islands, U.S.',
},
'WF' : {
name: 'Wallis And Futuna',
},
'EH' : {
name: 'Western Sahara',
},
'YE' : {
name: 'Yemen',
},
'ZM' : {
name: 'Zambia',
},
'ZW' : {
name: 'Zimbabwe'
},
};
convertCountryCode = (code) => {
return isoCountries[code].name;
}```
我绝不是 javascript 专家,但我是 Zapier 的超级粉丝。我稍微修改了您的代码,认为这应该可行。
/* jshint esversion: 6 */
const isoCountries = [
{
code: 'AF',
name: 'Afghanistan'
},
{
code: 'AX',
name: 'Aland Islands'
},
{
code: 'AL',
name: 'Albania'
},
{
code: 'DZ',
name: 'Algeria'
},
{
code: 'AS',
name: 'American Samoa'
},
{
code: 'AD',
name: 'Andorra'
},
{
code: 'AO',
name: 'Angola'
},
{
code: 'AI',
name: 'Anguilla'
},
{
code: 'AQ',
name: 'Antarctica'
},
{
code: 'AG',
name: 'Antigua And Barbuda'
},
{
code: 'AR',
name: 'Argentina'
},
{
code: 'AM',
name: 'Armenia'
},
{
code: 'AW',
name: 'Aruba'
},
{
code: 'AU',
name: 'Australia'
},
{
code: 'AT',
name: 'Austria'
},
{
code: 'AZ',
name: 'Azerbaijan'
},
{
code: 'BS',
name: 'Bahamas'
},
{
code: 'BH',
name: 'Bahrain'
},
{
code: 'BD',
name: 'Bangladesh'
},
{
code: 'BB',
name: 'Barbados'
},
{
code: 'BY',
name: 'Belarus'
},
{
code: 'BE',
name: 'Belgium'
},
{
code: 'BZ',
name: 'Belize'
},
{
code: 'BJ',
name: 'Benin'
},
{
code: 'BM',
name: 'Bermuda'
},
{
code: 'BT',
name: 'Bhutan'
},
{
code: 'BO',
name: 'Bolivia'
},
{
code: 'BA',
name: 'Bosnia And Herzegovina'
},
{
code: 'BW',
name: 'Botswana'
},
{
code: 'BV',
name: 'Bouvet Island'
},
{
code: 'BR',
name: 'Brazil'
},
{
code: 'IO',
name: 'British Indian Ocean Territory'
},
{
code: 'BN',
name: 'Brunei Darussalam'
},
{
code: 'BG',
name: 'Bulgaria'
},
{
code: 'BF',
name: 'Burkina Faso'
},
{
code: 'BI',
name: 'Burundi'
},
{
code: 'KH',
name: 'Cambodia'
},
{
code: 'CM',
name: 'Cameroon'
},
{
code: 'CA',
name: 'Canada'
},
{
code: 'CV',
name: 'Cape Verde'
},
{
code: 'KY',
name: 'Cayman Islands'
},
{
code: 'CF',
name: 'Central African Republic'
},
{
code: 'TD',
name: 'Chad'
},
{
code: 'CL',
name: 'Chile'
},
{
code: 'CN',
name: 'China'
},
{
code: 'CX',
name: 'Christmas Island'
},
{
code: 'CC',
name: 'Cocos (Keeling) Islands'
},
{
code: 'CO',
name: 'Colombia'
},
{
code: 'KM',
name: 'Comoros'
},
{
code: 'CG',
name: 'Congo'
},
{
code: 'CD',
name: 'Congo, Democratic Republic'
},
{
code: 'CK',
name: 'Cook Islands'
},
{
code: 'CR',
name: 'Costa Rica'
},
{
code: 'CI',
name: 'Cote D\'Ivoire'
},
{
code: 'HR',
name: 'Croatia'
},
{
code: 'CU',
name: 'Cuba'
},
{
code: 'CY',
name: 'Cyprus'
},
{
code: 'CZ',
name: 'Czech Republic'
},
{
code: 'DK',
name: 'Denmark'
},
{
code: 'DJ',
name: 'Djibouti'
},
{
code: 'DM',
name: 'Dominica'
},
{
code: 'DO',
name: 'Dominican Republic'
},
{
code: 'EC',
name: 'Ecuador'
},
{
code: 'EG',
name: 'Egypt'
},
{
code: 'SV',
name: 'El Salvador'
},
{
code: 'GQ',
name: 'Equatorial Guinea'
},
{
code: 'ER',
name: 'Eritrea'
},
{
code: 'EE',
name: 'Estonia'
},
{
code: 'ET',
name: 'Ethiopia'
},
{
code: 'FK',
name: 'Falkland Islands (Malvinas)'
},
{
code: 'FO',
name: 'Faroe Islands'
},
{
code: 'FJ',
name: 'Fiji'
},
{
code: 'FI',
name: 'Finland'
},
{
code: 'FR',
name: 'France'
},
{
code: 'GF',
name: 'French Guiana'
},
{
code: 'PF',
name: 'French Polynesia'
},
{
code: 'TF',
name: 'French Southern Territories'
},
{
code: 'GA',
name: 'Gabon'
},
{
code: 'GM',
name: 'Gambia'
},
{
code: 'GE',
name: 'Georgia'
},
{
code: 'DE',
name: 'Germany'
},
{
code: 'GH',
name: 'Ghana'
},
{
code: 'GI',
name: 'Gibraltar'
},
{
code: 'GR',
name: 'Greece'
},
{
code: 'GL',
name: 'Greenland'
},
{
code: 'GD',
name: 'Grenada'
},
{
code: 'GP',
name: 'Guadeloupe'
},
{
code: 'GU',
name: 'Guam'
},
{
code: 'GT',
name: 'Guatemala'
},
{
code: 'GG',
name: 'Guernsey'
},
{
code: 'GN',
name: 'Guinea'
},
{
code: 'GW',
name: 'Guinea-Bissau'
},
{
code: 'GY',
name: 'Guyana'
},
{
code: 'HT',
name: 'Haiti'
},
{
code: 'HM',
name: 'Heard Island & Mcdonald Islands'
},
{
code: 'VA',
name: 'Holy See (Vatican City State)'
},
{
code: 'HN',
name: 'Honduras'
},
{
code: 'HK',
name: 'Hong Kong'
},
{
code: 'HU',
name: 'Hungary'
},
{
code: 'IS',
name: 'Iceland'
},
{
code: 'IN',
name: 'India'
},
{
code: 'ID',
name: 'Indonesia'
},
{
code: 'IR',
name: 'Iran, Islamic Republic Of'
},
{
code: 'IQ',
name: 'Iraq'
},
{
code: 'IE',
name: 'Ireland'
},
{
code: 'IM',
name: 'Isle Of Man'
},
{
code: 'IL',
name: 'Israel'
},
{
code: 'IT',
name: 'Italy'
},
{
code: 'JM',
name: 'Jamaica'
},
{
code: 'JP',
name: 'Japan'
},
{
code: 'JE',
name: 'Jersey'
},
{
code: 'JO',
name: 'Jordan'
},
{
code: 'KZ',
name: 'Kazakhstan'
},
{
code: 'KE',
name: 'Kenya'
},
{
code: 'KI',
name: 'Kiribati'
},
{
code: 'KR',
name: 'Korea'
},
{
code: 'KW',
name: 'Kuwait'
},
{
code: 'KG',
name: 'Kyrgyzstan'
},
{
code: 'LA',
name: 'Lao People\'s Democratic Republic'
},
{
code: 'LV',
name: 'Latvia'
},
{
code: 'LB',
name: 'Lebanon'
},
{
code: 'LS',
name: 'Lesotho'
},
{
code: 'LR',
name: 'Liberia'
},
{
code: 'LY',
name: 'Libyan Arab Jamahiriya'
},
{
code: 'LI',
name: 'Liechtenstein'
},
{
code: 'LT',
name: 'Lithuania'
},
{
code: 'LU',
name: 'Luxembourg'
},
{
code: 'MO',
name: 'Macao'
},
{
code: 'MK',
name: 'Macedonia'
},
{
code: 'MG',
name: 'Madagascar'
},
{
code: 'MW',
name: 'Malawi'
},
{
code: 'MY',
name: 'Malaysia'
},
{
code: 'MV',
name: 'Maldives'
},
{
code: 'ML',
name: 'Mali'
},
{
code: 'MT',
name: 'Malta'
},
{
code: 'MH',
name: 'Marshall Islands'
},
{
code: 'MQ',
name: 'Martinique'
},
{
code: 'MR',
name: 'Mauritania'
},
{
code: 'MU',
name: 'Mauritius'
},
{
code: 'YT',
name: 'Mayotte'
},
{
code: 'MX',
name: 'Mexico'
},
{
code: 'FM',
name: 'Micronesia, Federated States Of'
},
{
code: 'MD',
name: 'Moldova'
},
{
code: 'MC',
name: 'Monaco'
},
{
code: 'MN',
name: 'Mongolia'
},
{
code: 'ME',
name: 'Montenegro'
},
{
code: 'MS',
name: 'Montserrat'
},
{
code: 'MA',
name: 'Morocco'
},
{
code: 'MZ',
name: 'Mozambique'
},
{
code: 'MM',
name: 'Myanmar'
},
{
code: 'NA',
name: 'Namibia'
},
{
code: 'NR',
name: 'Nauru'
},
{
code: 'NP',
name: 'Nepal'
},
{
code: 'NL',
name: 'Netherlands'
},
{
code: 'AN',
name: 'Netherlands Antilles'
},
{
code: 'NC',
name: 'New Caledonia'
},
{
code: 'NZ',
name: 'New Zealand'
},
{
code: 'NI',
name: 'Nicaragua'
},
{
code: 'NE',
name: 'Niger'
},
{
code: 'NG',
name: 'Nigeria'
},
{
code: 'NU',
name: 'Niue'
},
{
code: 'NF',
name: 'Norfolk Island'
},
{
code: 'MP',
name: 'Northern Mariana Islands'
},
{
code: 'NO',
name: 'Norway'
},
{
code: 'OM',
name: 'Oman'
},
{
code: 'PK',
name: 'Pakistan'
},
{
code: 'PW',
name: 'Palau'
},
{
code: 'PS',
name: 'Palestinian Territory, Occupied'
},
{
code: 'PA',
name: 'Panama'
},
{
code: 'PG',
name: 'Papua New Guinea'
},
{
code: 'PY',
name: 'Paraguay'
},
{
code: 'PE',
name: 'Peru'
},
{
code: 'PH',
name: 'Philippines'
},
{
code: 'PN',
name: 'Pitcairn'
},
{
code: 'PL',
name: 'Poland'
},
{
code: 'PT',
name: 'Portugal'
},
{
code: 'PR',
name: 'Puerto Rico'
},
{
code: 'QA',
name: 'Qatar'
},
{
code: 'RE',
name: 'Reunion'
},
{
code: 'RO',
name: 'Romania'
},
{
code: 'RU',
name: 'Russian Federation'
},
{
code: 'RW',
name: 'Rwanda'
},
{
code: 'BL',
name: 'Saint Barthelemy'
},
{
code: 'SH',
name: 'Saint Helena'
},
{
code: 'KN',
name: 'Saint Kitts And Nevis'
},
{
code: 'LC',
name: 'Saint Lucia'
},
{
code: 'MF',
name: 'Saint Martin'
},
{
code: 'PM',
name: 'Saint Pierre And Miquelon'
},
{
code: 'VC',
name: 'Saint Vincent And Grenadines'
},
{
code: 'WS',
name: 'Samoa'
},
{
code: 'SM',
name: 'San Marino'
},
{
code: 'ST',
name: 'Sao Tome And Principe'
},
{
code: 'SA',
name: 'Saudi Arabia'
},
{
code: 'SN',
name: 'Senegal'
},
{
code: 'RS',
name: 'Serbia'
},
{
code: 'SC',
name: 'Seychelles'
},
{
code: 'SL',
name: 'Sierra Leone'
},
{
code: 'SG',
name: 'Singapore'
},
{
code: 'SK',
name: 'Slovakia'
},
{
code: 'SI',
name: 'Slovenia'
},
{
code: 'SB',
name: 'Solomon Islands'
},
{
code: 'SO',
name: 'Somalia'
},
{
code: 'ZA',
name: 'South Africa'
},
{
code: 'GS',
name: 'South Georgia And Sandwich Isl.'
},
{
code: 'ES',
name: 'Spain'
},
{
code: 'LK',
name: 'Sri Lanka'
},
{
code: 'SD',
name: 'Sudan'
},
{
code: 'SR',
name: 'Suriname'
},
{
code: 'SJ',
name: 'Svalbard And Jan Mayen'
},
{
code: 'SZ',
name: 'Swaziland'
},
{
code: 'SE',
name: 'Sweden'
},
{
code: 'CH',
name: 'Switzerland'
},
{
code: 'SY',
name: 'Syrian Arab Republic'
},
{
code: 'TW',
name: 'Taiwan'
},
{
code: 'TJ',
name: 'Tajikistan'
},
{
code: 'TZ',
name: 'Tanzania'
},
{
code: 'TH',
name: 'Thailand'
},
{
code: 'TL',
name: 'Timor-Leste'
},
{
code: 'TG',
name: 'Togo'
},
{
code: 'TK',
name: 'Tokelau'
},
{
code: 'TO',
name: 'Tonga'
},
{
code: 'TT',
name: 'Trinidad And Tobago'
},
{
code: 'TN',
name: 'Tunisia'
},
{
code: 'TR',
name: 'Turkey'
},
{
code: 'TM',
name: 'Turkmenistan'
},
{
code: 'TC',
name: 'Turks And Caicos Islands'
},
{
code: 'TV',
name: 'Tuvalu'
},
{
code: 'UG',
name: 'Uganda'
},
{
code: 'UA',
name: 'Ukraine'
},
{
code: 'AE',
name: 'United Arab Emirates'
},
{
code: 'GB',
name: 'United Kingdom'
},
{
code: 'US',
name: 'United States'
},
{
code: 'UM',
name: 'United States Outlying Islands'
},
{
code: 'UY',
name: 'Uruguay'
},
{
code: 'UZ',
name: 'Uzbekistan'
},
{
code: 'VU',
name: 'Vanuatu'
},
{
code: 'VE',
name: 'Venezuela'
},
{
code: 'VN',
name: 'Viet Nam'
},
{
code: 'VG',
name: 'Virgin Islands, British'
},
{
code: 'VI',
name: 'Virgin Islands, U.S.'
},
{
code: 'WF',
name: 'Wallis And Futuna'
},
{
code: 'EH',
name: 'Western Sahara'
},
{
code: 'YE',
name: 'Yemen'
},
{
code: 'ZM',
name: 'Zambia'
},
{
code: 'ZW',
name: 'Zimbabwe'
}
];
return isoCountries.find(item => item.name === inputData.name);