Skip to content

daniwasonline/node-exchangerate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’° A simple exchange rate API for Node.js

GitHub package.json version NPM package version

node-exchangerate is a JavaScript wrapper providing daily Forex currency exchange data, via arzzen's exchangerate.host. It is compatible with Node.js, the browser, and React Native.

βž• Install

Node (yarn and npm)

# Yarn
> yarn add currencyexchanges

# NPM
> npm i currencyexchanges

Browser

<!-- browser and minified browser files are in dist/, download or use a Git file mirror to the raw file -->
<!-- you can also use an npm cdn pointing to dist/currencyexchanges-browser-min.js with 1.1.0+ -->
<script src="/path/to/currencyexchanges-browser.js"></script>

πŸ’½ Usage

Node

const NodeExr = require("currencyexchanges");
const ExchangeRate = new NodeExr({ primaryCurrency: "GBP" });

(async function () {
    await ExchangeRate.getExchangeRate("AUD", "GBP").then(console.log);
})();

Browser

<script src="/path/to/currencyexchanges-browser.js"></script>
<script>
    const ExchangeRates = new NodeExr({ primaryCurrency: "GBP" });
    ExchangeRates.getExchangeRate("EUR").then(result => console.log(result));
</script>

βœ”οΈ Features

  • πŸ’° Daily exchange rates for both single and multiple currencies
  • ⏰ Historical exchange rates between two time periods
  • πŸ“ˆ Daily fluctuation data exchange rates (start and end rates, percentages for change, etc.)

πŸ“š Documentation

  • The index.js file is extremely simple and the comments will help you understand what each function does

  • When developing with node-exchangerate in supported IDEs, the comments from the index.js file are interpreted by JSDoc to generate notes and documentation regarding functions and their parameters

  • The example file demonstrates each function with an explanation, an example usage of the function, and its' output (in the comments) of the file.

To-do

  • Fluctuations

  • Basic TypeScript configuration

  • Rewrite in TypeScript

  • Use ES instead of CommonJS for module source code

  • Add ES/CommonJS inoperability