Run the following command
npm install --save @coinify/currency
const currency = require('@coinify/currency');
currency exposes the following functions:
Returns the number of decimals after the floating point, with which the amount should be formatted, depending on the currency.
Convert an amount of money from the smallest sub-unit of the currency to the main-unit.
Convert an amount of money from the main-unit of the currency to the smallest sub-unit.
convertSubunitAmount(amountSubUnit, rate, fromCurrency, toCurrency)
Convert between sub-unit amounts of two currencies with a given rate, correctly converting between sub-units with different decimal amounts.
computeRateBetweenSubunitAmounts(fromCurrency, fromAmount, toCurrency, toAmount)
Computes a rate between two amounts in two different currencies.
Is the provided currency code a valid currency? (fiat or crypto)
Is the provided currency code a valid fiat currency?
Is the provided currency code a valid crypto currency?