getCountryFlagEmoji


(Last modified: )
/**
 * Get the emoji flag for a country code.
 * @link https://dev.to/jorik/country-code-to-flag-emoji-a21
 * @link https://gomakethings.com/getting-emoji-from-country-codes-with-vanilla-javascript/
 * @param {string} countryCode The two letter country code.
 * @returns {string} The country emoji flag.
 */
function getCountryFlagEmoji (countryCode) {
  return [...countryCode.toUpperCase()].map(char =>
    String.fromCodePoint(127397 + char.charCodeAt())
  ).reduce((a, b) => a + b)
};