currencyexchanges
v1.1.1
Published
๐ ๐ธ An exchange rate API using data from Forex (via exchangerate.host)
Downloads
42
Maintainers
Readme
๐ฐ A simple exchange rate API for Node.js
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
[x] Fluctuations
[x] Basic TypeScript configuration
[ ] Rewrite in TypeScript
[ ] Use ES instead of CommonJS for module source code
[ ] Add ES/CommonJS inoperability