Created
July 21, 2023 01:48
-
-
Save sacarino/2948d7b5170be6a299170fd037a1aa1c to your computer and use it in GitHub Desktop.
nstead of showing country codes (ie US, CH, NL), show the flag emojis, πΊπΈ π¨π and π³π±
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// thanks to https://dev.to/jorik/country-code-to-flag-emoji-a21 | |
function getFlagEmoji(countryCode) { | |
const codePoints = countryCode | |
.toUpperCase() | |
.split('') | |
.map(char => 127397 + char.charCodeAt()); | |
return String.fromCodePoint(...codePoints); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment