Socket
Socket
Sign inDemoInstall

currency-symbol-map

Package Overview
Dependencies
0
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    currency-symbol-map

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


Version published
Weekly downloads
260K
decreased by-7.69%
Maintainers
1
Install size
9.34 kB
Created
Weekly downloads
 

Readme

Source

currency-symbol-map

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

Installation

npm install currency-symbol-map

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": "£",
  ...
}
*/

Deprecated usage

Old usage still works, but could be removed in future versions.

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

Tests

npm test

Credits

Currency symbols originally sourced from xe, but maintained and updated by contributors.

Keywords

FAQs

Last updated on 09 Apr 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc