currency-map-symbol
A function to lookup the currency symbol for a given currency code and vice versa.
Installation
npm i currency-map-symbol --save
Usage
Get symbol from currency code
var getSymbolFromCurrency = require('currency-map-symbol').getSymbolFromCurrency;
getSymbolFromCurrency('GBP');
getSymbolFromCurrency('EUR');
getSymbolFromCurrency('USD');
getSymbolFromCurrency('NOT A VALID CODE');
Get currency code from symbol
var getCurrencyFromSymbol = require('currency-map-symbol').getCurrencyFromSymbol;
getCurrencyFromSymbol('£');
getCurrencyFromSymbol('€');
getCurrencyFromSymbol('$');
getCurrencyFromSymbol('NOT A VALID CODE');
Exposed maps for other processing
var symbolCurrencyMap = require('currency-map-symbol').symbolCurrencyMap;
var currencySymbolMap = require('currency-map-symbol').currencySymbolMap;
Shorthand usage
var getSymbol = require('currency-map-symbol')
getSymbol('GBP')
getSymbol('EUR')
getSymbol('USD')
getSymbol('NOT A VALID CODE')
ES6 usage
import {getSymbolFromCurrency} from 'currency-map-symbol';
getSymbolFromCurrency('GBP');
Tests
npm test
Credits
Currency symbols originally sourced from xe