Update src/phonenumber.ts
Co-authored-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
parent
1a713119d8
commit
99aeb8388d
1 changed files with 1 additions and 0 deletions
|
@ -36,6 +36,7 @@ const COUNTRY_CODE_REGEX = /^[A-Z]{2}$/;
|
||||||
|
|
||||||
export const getEmojiFlag = (countryCode: string) => {
|
export const getEmojiFlag = (countryCode: string) => {
|
||||||
if (!COUNTRY_CODE_REGEX.test(countryCode)) return '';
|
if (!COUNTRY_CODE_REGEX.test(countryCode)) return '';
|
||||||
|
// Rip the country code out of the emoji and use that
|
||||||
return String.fromCodePoint(...countryCode.split('').map(l => UNICODE_BASE + l.charCodeAt(0)));
|
return String.fromCodePoint(...countryCode.split('').map(l => UNICODE_BASE + l.charCodeAt(0)));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue