3.3.5 • Published 2 years ago

currencies-map v3.3.5

Weekly downloads
131
License
MIT
Repository
github
Last release
2 years ago

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" ...]
3.3.0

2 years ago

3.3.5

2 years ago

3.3.4

2 years ago

3.3.3

2 years ago

3.2.1

4 years ago

3.2.0

4 years ago

3.1.3

4 years ago

3.1.2

4 years ago

3.0.3

4 years ago

3.1.1

4 years ago

3.0.2

4 years ago

3.1.0

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago