Show country flag emoji

This commit is contained in:
nymkappa
2022-07-18 00:55:47 +02:00
parent f16076b401
commit ccdeb108ee
5 changed files with 26 additions and 5 deletions

View File

@@ -90,3 +90,11 @@ export function detectWebGL() {
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
return (gl && gl instanceof WebGLRenderingContext);
}
export function getFlagEmoji(countryCode) {
const codePoints = countryCode
.toUpperCase()
.split('')
.map(char => 127397 + char.charCodeAt());
return String.fromCodePoint(...codePoints);
}