-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(utils): formatNumberWithCurrency locale 값 타입을 locale 포맷에 맞게 변경 (#671
- Loading branch information
Showing
9 changed files
with
251 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@modern-kit/utils': patch | ||
--- | ||
|
||
fix(utils): formatNumberWithCurrency locale 값 타입을 locale 포맷에 맞게 변경 - @ssi02014 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/utils/src/formatter/formatNumberWithCurrency/formatNumberWithCurrency.constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export const LOCALE_CURRENCY_MAP = { | ||
'ko-KR': { currency: 'KRW' }, // 대한민국 | ||
'en-US': { currency: 'USD' }, // 미국 | ||
'ja-JP': { currency: 'JPY' }, // 일본 | ||
'zh-CN': { currency: 'CNY' }, // 중국 | ||
'de-DE': { currency: 'EUR' }, // 독일 | ||
'en-GB': { currency: 'GBP' }, // 영국 | ||
'fr-FR': { currency: 'EUR' }, // 프랑스 | ||
'it-IT': { currency: 'EUR' }, // 이탈리아 | ||
'es-ES': { currency: 'EUR' }, // 스페인 | ||
'nl-NL': { currency: 'EUR' }, // 네덜란드 | ||
'pt-PT': { currency: 'EUR' }, // 포르투갈 | ||
'zh-HK': { currency: 'HKD' }, // 홍콩 | ||
'ru-RU': { currency: 'RUB' }, // 러시아 | ||
'ar-SA': { currency: 'SAR' }, // 사우디아라비아 | ||
'tr-TR': { currency: 'TRY' }, // 터키 | ||
'vi-VN': { currency: 'VND' }, // 베트남 | ||
'th-TH': { currency: 'THB' }, // 태국 | ||
'id-ID': { currency: 'IDR' }, // 인도네시아 | ||
'my-MY': { currency: 'MYR' }, // 말레이시아 | ||
'ph-PH': { currency: 'PHP' }, // 필리핀 | ||
'sg-SG': { currency: 'SGD' }, // 싱가포르 | ||
'nz-NZ': { currency: 'NZD' }, // 뉴질랜드 | ||
// 필요 시 추가 | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
packages/utils/src/formatter/formatNumberWithCurrency/formatNumberWithCurrency.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
type Locale = 'KRW' | 'KRW_SYMBOL' | 'USD' | 'JPY' | 'CNY' | 'EUR'; | ||
import { LOCALE_CURRENCY_MAP } from './formatNumberWithCurrency.constants'; | ||
|
||
export type Locale = keyof typeof LOCALE_CURRENCY_MAP; | ||
|
||
export interface FormatNumberCurrencyOptions { | ||
symbol?: string; | ||
position?: 'prefix' | 'suffix'; | ||
space?: boolean; | ||
commas?: boolean; | ||
locale?: Locale; | ||
decimal?: number; | ||
} |
50 changes: 10 additions & 40 deletions
50
packages/utils/src/formatter/formatNumberWithCurrency/formatNumberWithCurrency.utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.