currencies
v0.0.2
Published
A simple library for currency symbols, names, and exchange rates.
Downloads
1,076
Readme
#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').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'].value === 1
});
##License
MIT