Skip to content

A function to lookup the currency symbol for a given currency code and vice versa.

License

Notifications You must be signed in to change notification settings

ZakZubair/currency-map-symbol

Repository files navigation

currency-map-symbol

Build Status PRs Welcome Known Vulnerabilities

A function to lookup the currency symbol for a given currency code.

Installation

npm install currency-map-symbol

Test

Simple test

npm run test

Test with watch

npm run test:watch 

Test coverage

npm run test:coverage  

Usage

Get symbol from currency code

// ES5
const getSymbolFromCurrency = require('currency-map-symbol')

// ES6
import getSymbolFromCurrency from 'currency-map-symbol'

getSymbolFromCurrency('GBP') //=> '£'
getSymbolFromCurrency('EUR') //=> '€'
getSymbolFromCurrency('USD') //=> '$'
getSymbolFromCurrency('NOT A VALID CODE') //=> undefined

Exposed map for other processing

// ES5
const getSymbolFromCurrency = require('currency-map-symbol')

// ES6
import getSymbolFromCurrency from 'currency-map-symbol'

/* =>
{
 "USD" : "$",
 "GBP" : "£",

}
*/

Credits

Currency symbols originally sourced from xe

About

A function to lookup the currency symbol for a given currency code and vice versa.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published