Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
@coinify/currency
Advanced tools
Run the following command
npm install --save @coinify/currency
const currency = require('@coinify/currency');
currency
exposes the following functions:
getDecimalsForCurrency(currency)
Returns the number of decimals after the floating point, with which the amount should be formatted, depending on the currency.
fromSmallestSubunit(amount, currency)
Convert an amount of money from the smallest sub-unit of the currency to the main-unit.
toSmallestSubunit(amount, currency)
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.
isValidCurrency(code)
Is the provided currency code a valid currency? (fiat or crypto)
isValidFiatCurrency(code)
Is the provided currency code a valid fiat currency?
isValidCryptoCurrency(code)
Is the provided currency code a valid crypto currency?
FAQs
Helper functions for managing amounts in different currencies
We found that @coinify/currency demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.