Currency-in-cache
Library based on currency module in npm. A distinctive feature is that exchange rates are downloaded on demand, rather than every time when there is a conversion. Library Interfaces can be found in test/currency.js
How use it
You need start update data loop end use object.
Example
const Currency = require('currency-performance');
// set your currency and delay time loop
let cur = new Currency(['USD', 'RUB', 'EUR'], 60 * 1000 * 5);
// errorHandler for loop errors
cur.errorHandler = (error) => {
throw error;
};
cur.startLoop();
cur.initial((error) => {
if (error) {
return done(error);
}
// use ( if from or to currency not found throw error
let amount = cur.convert('USD', 'EUR', 100);
});