mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-28 22:00:51 +00:00
🚧 add country code flag emoji function
This commit is contained in:
6
src/lib/countryCodeToFlagEmoji.ts
Normal file
6
src/lib/countryCodeToFlagEmoji.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export function countryCodeToFlagEmoji(isoAlpha2: string) {
|
||||
const codePoints = [...isoAlpha2.toUpperCase()].map(
|
||||
(char) => 0x1f1e6 + char.charCodeAt(0) - 65
|
||||
);
|
||||
return String.fromCodePoint(...codePoints);
|
||||
}
|
||||
Reference in New Issue
Block a user