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
268K
increased by2.36%
Maintainers
1
Install size
7.37 kB
Created
Weekly downloads
 

Readme

Source

currency-symbol-map

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

Installation

npm install currency-symbol-map

Usage

Get symbol from currency code

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

Exposed map for other processing

const currencySymbolMap = require('currency-symbol-map/map')
// =>
{
 "USD": "$",
 "GBP": "£",
 …
}

Tests

npm test

Changelog

4.0.0

  • the reverse lookup feature was removed (retrieving currency given a symbol) because there is not a deterministic way to do so (i.e. the same symbol is used by multiple currencies).
  • in previous versions, an unsuccessful lookup would return the '?' character. It now returns undefined so that it is up to you how to handle the failure.

Credits

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

Keywords

FAQs

Last updated on 04 May 2017

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