Options
All
  • Public
  • Public/Protected
  • All
Menu

nbrb

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