13 lines
316 B
TypeScript
Raw Permalink Normal View History

2024-12-30 23:50:15 +01:00
import {getCountryCode} from './getCountryCode'
2024-08-22 01:44:50 +02:00
export const tldToEmoji = (tld: string) => {
if (tld.startsWith('xn--')) return '-'
return String.fromCodePoint(
...getCountryCode(tld)
.toUpperCase()
.split('')
.map((char) => 127397 + char.charCodeAt(0))
)
2024-12-30 23:50:15 +01:00
}