Socket
Socket
Sign inDemoInstall

currency-symbols

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    currency-symbols

A tiny library providing mappings of currency codes to currency symbols


Version published
Weekly downloads
839
increased by53.94%
Maintainers
1
Install size
11.1 kB
Created
Weekly downloads
 

Readme

Source

currency-symbols

A tiny library that maps currency codes to currency symbols. No dependencies. Several ways to get the symbol you want.

Currently supports all currency symbols with a Unicode value. Support for other currencies coming soon!

Installation

npm install currency-symbols

Usage

Use the helper function

import getCurrencySymbol from 'currency-symbols';

getCurrencySymbol('USD'); // '$'
getCurrencySymbol('EUR'); // '€'
getCurrencySymbol('INVALID') // undefined

Import a constant matching the symbol you need

import { USD, EUR } from 'currency-symbols';

console.log(`American Dollar: ${USD}`); // American Dollar: $
console.log(`Euro: ${EUR}`); // Euro: €

Import the whole damn map

import { CURRENCY_SYMBOLS } from 'currency-symbols';

console.log(`British Pound: ${CURRENCY_SYMBOLS.GBP}`);

FAQs

Last updated on 04 Nov 2019

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