New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

currencies-map

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

currencies-map

Map from currency codes to currency names and symbols

3.3.5
latest
Source
npm
Version published
Weekly downloads
518
-7.66%
Maintainers
1
Weekly downloads
 
Created
Source

Currencies Map

Currency codes mapping to currency names and symbols using native javascript API to get local currency names and symbols.

alt text

It contains type declarations for Typescript.

It uses navigator.language to show the correct currency symbol or name.

Example: Currency code USD

If your device language is es-ES you will get:

  • Currency name: dólares estadounidenses
  • Currency symbol: US$

If your device language is en-GB you will get:

  • Currency name: US dollars
  • Currency symbol: US$

Install

yarn add currencies-map

or

npm install currencies-map

Using it

import {Currencies} from 'currencies-map';

Getting currency name

const currencyCode = 'EUR';
console.info(currencyCode + ': ' + Currencies.names.get(currencyCode));

Output (device language es-ES)

"EUR: euros"

Getting currency symbol

const currencyCode = 'EUR';
console.info(currencyCode + ': ' + Currencies.symbols.get(currencyCode));

Output

"EUR: €"

List all names

console.info([...Currencies.names.values()]);

Output (device language es-ES)

["euros", "dólares estadounidenses", "kiats" ...]

List all symbols

console.info([...Currencies.symbols.values()]);

Output

["€", "US$", "MMK" ...]

When the currency doesn't have symbol it will show currency code.

List all currency codes

import {CODES} from 'currencies-map';
console.info(CODES);

Output

["EUR", "USD", "MMK" ...]

Keywords

currency

FAQs

Package last updated on 31 Jan 2022

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