Skip to content

NaturalDevCR/bccr-exchange-rates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BCCR Exchange Rates Client (TypeScript)

npm version

A modern, reliable, and TypeScript-based client to get the daily USD exchange rate (buy/sell) from the official Web Service of the Banco Central de Costa Rica (BCCR).

This package is fully typed, providing an excellent developer experience with autocompletion and compile-time error checking.

Features

  • Type-Safe: Written entirely in TypeScript.
  • Class-based, modern API.
  • Uses ES Modules.
  • Robust error handling with custom error types.
  • Lightweight and focused.

Requirements

  • Node.js v18 or higher.
  • You must enroll in the BCCR Web Service to get a valid email and token.

Installation

npm install bccr-exchange-rates

Usage

The package exports a BCCRClient class and its associated types. It's highly recommended to use environment variables for your credentials.

Error Handling

The client throws specific, typed errors. You can import them to handle different failure scenarios gracefully.

  • BCCRValidationError: For invalid input parameters.
  • BCCRWebServiceError: For errors from the BCCR API or parsing issues.

Building from Source

If you clone the repository, you can build the project from the TypeScript source files.

About

Get BCCR Exchange Rates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published