@ooneex/currencies ships a curated dataset of world currencies (code, name, symbol, and flag icon) together with fully typed currency codes. It also includes a CurrencyConverter for managing exchange rates, converting amounts, and formatting them with the correct symbol.
Installation
Add the package with Bun.Usage
Import theCURRENCIES dataset to look up metadata, or use CurrencyConverter to handle rates and conversions.
Browse the dataset
Convert between currencies
Create a converter with a base currency (rate1) and seed it with rates expressed relative to that base.
Format and convert in one step
format prefixes the amount with the currency symbol; convertAndFormat converts then formats.
When to use it
- You need a ready-made, typed list of currencies (codes, names, symbols, flag icons) for dropdowns, pickers, or validation.
- You want to convert amounts between currencies using exchange rates you supply (e.g. fetched from a rates API).
- You want quick symbol-prefixed formatting without pulling in
Intl.NumberFormatconfiguration. - Not needed if you only require locale-aware number formatting with no conversion — the native
Intl.NumberFormatalready covers that.