formatCurrency
Formats a number as localized currency using Intl.NumberFormat. The locale follows the package locale fallback unless a locale is provided explicitly.
Importing
ts
import { formatCurrency } from '@almighty-shogun/utils'Usage
ts
import { formatCurrency } from '@almighty-shogun/utils'
const total = formatCurrency(1299.5, 'EUR', 'nl');Parameters
value: number
Value to format.
currency?: string
Currency code.
Default: EUR
locale?: string
Locale override.
Returns
A localized currency string with exactly two fraction digits. When no currency is provided, Euro formatting is used.Type signature
ts
declare function formatCurrency(
value: number,
currency?: string,
locale?: string
): string;