Skip to content

Mapping of countries and their primary currency along with currency data.

License

Notifications You must be signed in to change notification settings

ZakZubair/currency-map-country

Repository files navigation

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

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'

About

Mapping of countries and their primary currency along with currency data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published