import { TCountryCode } from './types' ; const UNICODE_BASE = 127462 - 'A' . charCodeAt ( 0 ) ; const COUNTRY_CODE_REGEX = /^[A-Z]{2}$/ ; export const getEmojiFlag = ( countryCode ) : string => COUNTRY_CODE_REGEX . test ( countryCode ) ? String . fromCodePoint ( ... countryCode . split ( '' ) . map ( ( letter ) => UNICODE_BASE + letter . toUpperCase ( ) . charCodeAt ( 0 ) ) ) : '' ;