1.0.1 • Published 2 years ago

nbrb v1.0.1

Weekly downloads
-
License
AGPL-3.0-only
Repository
github
Last release
2 years ago

nbrb CI Status version Known Vulnerabilities Coverage Status code style: prettier semantic-release Conventional Commits GitHub top language node version npm downloads License

A simple Node.js library for the NBRB API.

Installation

npm install nbrb

Usage

NBRBClient

import { NBRBClient } from "nbrb";
const client = new NBRBClient();
  • .getCurrencies()
const currencies = await client.getCurrencies();
  • .getCurrency()
const Cur_ID = 431;
const currency = await client.getCurrency({ Cur_ID });
  • .getRates()
const ondate = new Date("2020-8-1");
const rates = await client.getRates({ ondate });
  • .getRate()
const ondate = new Date("2020-8-1");
// by `Cur_ID`
const Cur_ID = 431;
const rate = await client.getRate({ ondate, Cur_ID });
// by `Cur_Code`
const Cur_Code = "840";
const rate = await client.getRate({ ondate, Cur_Code });
// by `Cur_Abbreviation`
const Cur_Abbreviation = "USD";
const rate = await client.getRate({ ondate, Cur_Abbreviation });
  • .getDynamics()
const startdate = new Date("2021-8-1");
const enddate = new Date();
const Cur_ID = 431;
const rates = await client.getDynamics({ startdate, enddate, Cur_ID });

Test

npm run test:ci