currency-map-country
v1.0.12
Published
Mapping of countries and their primary currency.
Downloads
265
Maintainers
Readme
Mapping of countries and their primary currency along with currency data.
Installation
npm install currency-map-country
Test
Simple test
npm run test
Test with watch
npm run test:watch
Test coverage
npm run test:coverage
Usage
Get country data from country name
import { getCountry } from 'currency-map-country';
getCountry('USA'); //=> { abbreviation: 'US', currency: 'USD' }
getCountry('Canada'); //=> { abbreviation: 'CA', currency: 'CAD' }
Get currency data from currency abbreviation
import { getCurrency } from 'currency-map-country';
getCurrency('USD'); //=> { name: 'U.S. Dollar (USD)', symbolFormat: '${#}' }
getCurrency('CAD'); //=> { name: 'Canadian Dollar (CAD)', symbolFormat: 'C${#}' }
Get currency abbreviation from a country name
import { getCurrencyAbbreviation } from 'currency-map-country';
getCurrencyAbbreviation('UK'); //=> 'GBP'
getCurrencyAbbreviation('Canada'); //=> 'CAD'
Get country from abbreviation
import { getCountryByAbbreviation } from 'currency-map-country';
getCountryByAbbreviation('UK'); //=> 'UK'
getCurrencyAbbreviation('US'); //=> 'USA'
Get Currency List
import { getCurrencyList } from 'currency-map-country';
getCurrencyList(); //=> [ { abbr: "AFA", name: "Afghanistan Afghani (AFA)", symbolFormat: "AFA {#}" }, { abbr: "ALL", name: "Albanian Lek (ALL)", symbolFormat:, "ALL {#}" }, ... ]
Get Currency Abbreviation From Name
import { getCurrencyAbbreviationFromName } from 'currency-map-country';
getCurrencyAbbreviationFromName('U.S. Dollar (USD)'); //=> 'USD'