Skip to content

A tiny library providing mappings of currency codes to currency symbols

License

Notifications You must be signed in to change notification settings

pjaws/currency-symbols

Repository files navigation

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}`);

About

A tiny library providing mappings of currency codes to currency symbols

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published