New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

currency-symbol-mapper

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

currency-symbol-mapper

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

latest
Source
npmnpm
Version
4.0.0
Version published
Maintainers
1
Created
Source

currency-symbol-map

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

Installation

npm install currency-symbol-mapper

Usage

Get symbol from currency code

var getSymbolFromCurrency = require('currency-symbol-map').getSymbolFromCurrency;
getSymbolFromCurrency('GBP'); //=> '£'
getSymbolFromCurrency('EUR'); //=> '€'
getSymbolFromCurrency('USD'); //=> '$'
getSymbolFromCurrency('NOT A VALID CODE'); //=> undefined

Get currency code from symbol

var getCurrencyFromSymbol = require('currency-symbol-map').getCurrencyFromSymbol;
getCurrencyFromSymbol('£'); //=> 'GBP'
getCurrencyFromSymbol('€'); //=> 'EUR'
getCurrencyFromSymbol('$'); //=> 'USD'
getCurrencyFromSymbol('NOT A VALID CODE'); //=> undefined

Exposed maps for other processing

var symbolCurrencyMap = require('currency-symbol-map').symbolCurrencyMap;
/*
{
  "$": "USD",
  "£": "GBP",
  ...
}
*/

var currencySymbolMap = require('currency-symbol-map').currencySymbolMap;
/*
{
  "USD": "$",
  "GBP": "£",
  ...
}
*/

Shorthand usage

var getSymbol = require('currency-symbol-map')
getSymbol('GBP') //=> '£'
getSymbol('EUR') //=> '€'
getSymbol('USD') //=> '$'
getSymbol('NOT A VALID CODE') //=> '?'

Tests

npm test

Credits

Forked from project maintained by Ben Gourley (https://github.com/bengourley/currency-symbol-map).

Keywords

currency

FAQs

Package last updated on 20 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts