Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

currency-map-symbol

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

currency-map-symbol

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

  • 3.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
increased by83.44%
Maintainers
1
Weekly downloads
 
Created
Source

currency-map-symbol

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

Installation

npm install currency-map-symbol

Usage

Get symbol from currency code

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

Get currency code from symbol

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

Exposed maps for other processing

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

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

Shorthand usage

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

Tests

npm test

Credits

Currency symbols originally sourced from [xe](http://www.xe.com/symbols.php

Keywords

FAQs

Package last updated on 28 Mar 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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc