currencies

A simple library for currency symbols, names, and exchange rates.

npm install currencies
11 downloads in the last month

Currencies

A simple library for currency symbols, names, and exchange rates.

Usage

var currencies = require('currencies');

Initially you have just a map of currency names and symbols, which you can get or set:

currencies.get('USD').rate === 1
currencies.get('EUR').symbol === '€';
currencies.get('PLN').name === 'Polish Zloty';

get

Without an argument, returns the complete currencies map

currencies.get('USD')
currencies.get();

set

Set a currency's rate (USD-relative) yourself

currencies.set('EUR', 0.77);

currencies.set({
  EUR: 0.77,
  AUD: 1.05
});

update

Calling this function will update the internal currencies map with current exchange rate, using data from European Central Bank.

currencies.update(function(err, newCurrencies) {
  newCurrencies['USD'].rate === 1
});

License

MIT

npm loves you