currencies

0.0.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i currencies

Weekly Downloads

275

Version

0.0.2

License

none

Last publish

Collaborators

  • Weltschmerz