Valuta's
Valuta's
Het pakket bevat 179+ valuta's met ISO 4217-codes.
Valuta-eigenschappen
Elke valuta heeft de volgende velden:
| Veld | Beschrijving |
|---|---|
code | ISO 4217-valutacode (bijv. "USD") |
nativeName | Enkelvoudige naam (bijv. "US Dollar") |
nativeNamePlural | Meervoudige naam (bijv. "US Dollars") |
symbol | Valutasymbool (bijv. "$") |
Opzoeken op code
GoDartTypeScript
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); // $Alle valuta's weergeven
GoDartTypeScript
import { currencies } from 'infobits-intl';
const allCurrencies = Object.values(currencies);
console.log(allCurrencies.length);Valuta van een land
Elk land heeft een gekoppelde valuta.
GoDartTypeScript
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); // ??
}Typeveilige valutacodes
GoDartTypeScript
import { CurrencyCode, currencies } from 'infobits-intl';
const euro = currencies[CurrencyCode.EUR];
console.log(euro.nativeName); // Euro
console.log(euro.symbol); // ???