Convert cents (smallest currency unit) to dollar amount
The currency's minor unit comes from ISO 4217 through minorUnitExponent in payments-core, matched in any case. A code outside CurrencyCode gets its own multiplier (1000 for KWD, 1 for KRW).
minorUnitExponent
CurrencyCode
KWD
KRW
Amount in smallest currency unit
Currency code (default: USD)
Dollar amount
When currency is not a string, or is empty or only whitespace
currency
fromCents(1050n) // 10.50fromCents(1050n, 'USD') // 10.50fromCents(1000n, 'JPY') // 1000 Copy
fromCents(1050n) // 10.50fromCents(1050n, 'USD') // 10.50fromCents(1000n, 'JPY') // 1000
Convert cents (smallest currency unit) to dollar amount
The currency's minor unit comes from ISO 4217 through
minorUnitExponentin payments-core, matched in any case. A code outsideCurrencyCodegets its own multiplier (1000 forKWD, 1 forKRW).