add phonenumber convert

This commit is contained in:
kimpure 2026-05-21 15:11:45 +00:00
parent 99ab9428df
commit 2ee7f95df6
No known key found for this signature in database

View file

@ -204,8 +204,8 @@ export function saferKorean(input: string): string {
.replace(/[ㄱ-ㅎㄲㄸㅃㅆㅉ]/g, (char: string) => ChoseongMap[char as keyof typeof ChoseongMap]) .replace(/[ㄱ-ㅎㄲㄸㅃㅆㅉ]/g, (char: string) => ChoseongMap[char as keyof typeof ChoseongMap])
// Process number, unit // Process number, unit
.replace(/[\d\-]+/g, (phone: string) => { .replace(/(\+\d+[\s\-]+)?([\d\-]+)/g, (_, prefix: string, phone: string) => {
if (!phone.includes("-")) return phone; if (!phone.includes("-")) return prefix + phone;
return PhoneNumberKorean.convert(phone); return PhoneNumberKorean.convert(phone);
}) })
.replace(/([\d,]+)([kKMmgGtTpP][iI]?)[bB]/g, (_, num: string, mod: string) => { .replace(/([\d,]+)([kKMmgGtTpP][iI]?)[bB]/g, (_, num: string, mod: string) => {