diff --git a/packages/utils/saferKorean.ts b/packages/utils/saferKorean.ts index f95f315..e381337 100644 --- a/packages/utils/saferKorean.ts +++ b/packages/utils/saferKorean.ts @@ -175,6 +175,11 @@ export const GIFMap = { "images-ext-1.discordapp.net/external/2R41WcvNJwYMD69UKls2cDa_hEL-rzCRCFvOi2DDOVo/https/media.tenor.com/sU3RCOixDbgAAAPo/majo-no-tabitabi-the-journey-of-elaina.mp4": "일레이나 손짓", }; +export const Units = { + "㎢": "제곱킬로미터", + "㎡": "제곱미터", +} + export function processDots(input: string): string { return input.replace(/[\.,]+$/, "") .replace(/[\.,]{2,}/g, "") @@ -333,8 +338,7 @@ export function saferKorean(input: string): string { return FloatKorean.convert(num) + postfix; } }) - .replace(/㎡/g, "제곱미터") - .replace(/㎢/g, "제곱킬로미터") + .replace(/[㎡㎢]/g, (content: string) => Units[content as keyof typeof Units]) // Process symbol .replace(/[\%\^\&\*\#\@\.\-\+\_\=\/\\♡\$\|\:\;\>\<]/g, (t) => ( @@ -344,6 +348,7 @@ export function saferKorean(input: string): string { .replace(/[ \t\f\r]+/g, " ") // Process emoji + .replace(/[↑↓←→↓↔↕↖↗↘↙]/g, "화살표") .replace(/\p{Emoji}/u, " 이모지 ") .trim() }