cnb-exchange-rate

2.0.1 • Public • Published

cnb-exchange-rate

license coverage

Library can fetch czech daily exchange rate from Česká národní banka and return as object.

example js

const cnbExchangeRate = require('cnb-exchange-rate');
 
 
async function download() {
    try {
        const exchangeRateAsString = await cnbExchangeRate.fetch();
        const exchangeRate = cnbExchangeRate.parse(exchangeRateAsString);
 
        console.log(exchangeRate);
    } catch (err) {
        if (err.statusCode !== 200) {
            console.log(`I can\`t fetch czech daily course. Server returns status code: ${err.statusCode}`);
        } else {
            console.log(`I can\`t parse czech daily course. Error: ${err}`);
        }
    }
}
 
download();

Package Sidebar

Install

npm i cnb-exchange-rate

Weekly Downloads

2

Version

2.0.1

License

ISC

Unpacked Size

10.5 kB

Total Files

8

Last publish

Collaborators

  • tomas.pavlacky