2024-08-22 01:44:50 +02:00

12 lines
316 B
TypeScript

import {getCountryCode} from "./getCountryCode";
export const tldToEmoji = (tld: string) => {
if (tld.startsWith('xn--')) return '-'
return String.fromCodePoint(
...getCountryCode(tld)
.toUpperCase()
.split('')
.map((char) => 127397 + char.charCodeAt(0))
)
}