currency-performance

0.0.5 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i currency-performance

Weekly Downloads

1

Version

0.0.5

License

MIT

Last publish

Collaborators

  • clickganic-inc