diff --git a/apps/pr-reviewer/fixtures/demo-pr/currency.ts b/apps/pr-reviewer/fixtures/demo-pr/currency.ts index 21caeeb..2188de4 100644 --- a/apps/pr-reviewer/fixtures/demo-pr/currency.ts +++ b/apps/pr-reviewer/fixtures/demo-pr/currency.ts @@ -1,3 +1,12 @@ export function formatUsd(cents: number): string { return "$" + cents / 100; } + +const ZERO_DECIMAL_CURRENCIES = new Set(["JPY", "KRW", "VND"]); + +export function formatAmount(minorUnits: number, currency: string): string { + if (ZERO_DECIMAL_CURRENCIES.has(currency)) { + return `${minorUnits} ${currency}`; + } + return `${(minorUnits / 100).toFixed(2)} ${currency}`; +}