export function countryFlag(code: string): string {
const cc = code.trim().toUpperCase()
if (!/^[A-Z]{2}$/.test(cc)) {
return code
}
const A = 0x1f1e6
return String.fromCodePoint(
A + (cc.charCodeAt(0) - 65),
A + (cc.charCodeAt(1) - 65),
)
}
export function unfd(string: string): string {
return string.toLocaleUpperCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "")
}
export function lnfd(string: string): string {
return unfd(string).toLocaleLowerCase()
}
export function stripEmojis(string: string): string {
return string.replace(/[\p{Emoji}\p{Emoji_Component}]+/gu, "")
}
|