1.1.1 • Published 3 years ago

currencyexchanges v1.1.1

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
3 years ago

💰 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