currency-map-country

Mapping of countries and their primary currency.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
currency-map-country
211.0.125 years ago5 years agoMinified + gzip package size for currency-map-country in KB

Readme

currency-map-country Build Status Known Vulnerabilities PRs Welcome
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

```js import { getCountry } from 'currency-map-country'; getCountry('USA'); //=> { abbreviation: 'US', currency: 'USD' } getCountry('Canada'); //=> { abbreviation: 'CA', currency: 'CAD' } ```

Get currency data from currency abbreviation

```js 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

```js import { getCurrencyAbbreviation } from 'currency-map-country'; getCurrencyAbbreviation('UK'); //=> 'GBP' getCurrencyAbbreviation('Canada'); //=> 'CAD' ```

Get country from abbreviation

```js import { getCountryByAbbreviation } from 'currency-map-country'; getCountryByAbbreviation('UK'); //=> 'UK' getCurrencyAbbreviation('US'); //=> 'USA' ```

Get Currency List

```js 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

```js import { getCurrencyAbbreviationFromName } from 'currency-map-country'; getCurrencyAbbreviationFromName('U.S. Dollar (USD)'); //=> 'USD' ```