Skip to main content

Currency

import { convertCurrency, formatPrice, formatPriceCompact } from '@rtorcato/js-common/currency'

Exports

NameSummary
convertCurrencyConverts a given amount from one currency to another using the provided exchange rate.
formatPriceFormats a given price value into a localized currency string.
formatPriceCompactFormats a price in compact notation (e.g., $1.2K, $1.5M).
getCurrencyLocaleReturns the default locale typically associated with a currency.
getCurrencyNameReturns the full display name of a currency.
getCurrencySymbolLazily loads the currencies list to reduce bundle size.
isValidCurrencySynchronously checks if a currency code is valid using the Intl API.
isValidCurrencyCodeChecks if the provided currency code is valid.
parseCurrencyStringParses a currency string and extracts both the amount and currency code.
parsePriceParses a given price string and returns its numeric value.
roundToRounds a given number to a specified number of decimal places.