@brixtol/currency-codes
Country codes (3166-1 alpha-2) to Currency (ISO 4217) code mappings used by the Brixtol Textiles internal API when dealing with pricing and currency conversions. Supports all 249 countries to currency maps.
Minified: 2.23 KB
Gzipped: 1.08 KB
Install
pnpm
pnpm i @brixtol/currency-codes
Because pnpm is dope and does dope shit.
npm
npm install @brixtol/currency-codes
Yarn
yarn add @brixtol/currency-codes
Usage
You can pass in a country code that is lowercase, uppercase or a mixture of both.
import { getCurrency } from "@brixtol/currency-codes";
const sek = getCurrency("SE");
const eur = getCurrency("nl");
const eur = getCurrency("uS");
The module also exposes the raw mappings and interface on the export. The mappings object is provided read only using Object.freeze. The raw mappings are annotated with JSDoc comments so when using an editor that supports intellisense (ie: vscode) you will receive the country and currency name in completions and hovers.
import { Currencies, ICurrencies } from "@brixtol/currency-codes";
Currencies.SE;
Currencies.NL;
Currencies.RU;
ICurrencies.SE;
ICurrencies.NL;
ICurrencies.RU;
The interface is identical to the mapping.
Related
Currency code to currency symbol mappings:
Country code to country name mappings:
Currency code to currency.js symbol placement mappings:
License
Licensed under MIT
We ♡ open source!