mirror of
https://github.com/Nezumi-2711/Sink.git
synced 2026-09-22 13:48:35 +00:00
feat: init
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
const EMOJI_FLAG_UNICODE_STARTING_POSITION = 127397
|
||||
|
||||
export function getFlag(countryCode: string) {
|
||||
const regex = /^[A-Z]{2}$/.test(countryCode)
|
||||
if (!countryCode || !regex)
|
||||
return void 0
|
||||
return String.fromCodePoint(...countryCode.split('').map(char => EMOJI_FLAG_UNICODE_STARTING_POSITION + char.charCodeAt(0)))
|
||||
}
|
||||
Reference in New Issue
Block a user