1.0.12 • Published 6 years ago

currency-map-country v1.0.12

Weekly downloads
313
License
MIT
Repository
github
Last release
6 years ago

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'
1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.8

6 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago