Currencies
Currencies
The package includes 179+ currencies with ISO 4217 codes.
Currency Properties
Each currency has the following fields:
| Field | Description |
|---|---|
code | ISO 4217 currency code (e.g. "USD") |
nativeName | Singular name (e.g. "US Dollar") |
nativeNamePlural | Plural name (e.g. "US Dollars") |
symbol | Currency symbol (e.g. "$") |
Lookup by Code
import { getCurrencyByCode } from 'infobits-intl';
const currency = getCurrencyByCode('USD');
console.log(currency?.nativeName); // US Dollar
console.log(currency?.nativeNamePlural); // US Dollars
console.log(currency?.symbol); // $List All Currencies
import { currencies } from 'infobits-intl';
const allCurrencies = Object.values(currencies);
console.log(allCurrencies.length);Currency for a Country
Each country has a linked currency.
import { getCountryByAlpha2, getCurrencyByCode } from 'infobits-intl';
const country = getCountryByAlpha2('JP');
if (country) {
const currency = getCurrencyByCode(country.currency);
console.log(currency?.nativeName); // Japanese Yen
console.log(currency?.symbol); // ??
}