Socket
Socket
Sign inDemoInstall

exchangerate-javascript-sdk

Package Overview
Dependencies
2
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    exchangerate-javascript-sdk

Unofficial JavaScript SDK for Exchange rates API


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Installation

npm i exchangerate-javascript-sdk

Usage

// Only import what you need
import { latest, convert, historicalRates, timeseries, fluctuation, symbols, EUVATRates } from "exchangerate-javascript-sdk";

// Latest Rates.
latest().then((data) => console.log(data)); 

// Output: {motd: Object, success: true, base: "EUR", date: "2021-08-28", rates: Object}

// Currency conversion
convert({ from: "USD", to: "EUR", amount: 18 })
  .then((data) => console.log(data));
  
/* Output: {
  motd: Object
  success: true
  query: Object
  info: Object
  historical: false
  date: "2021-08-28"
  result: 15.259822
} */

// Currency conversion
convert({ from: "USD", to: "EUR", amount: 18, places: 2 })
  .then((data) => console.log(data));
  
/* Output: {
  motd: Object
  success: true
  query: Object
  info: Object
  historical: false
  date: "2021-08-28"
  result: 15.25 // using places property
} */

// Historical Rates
(async () => {
  const data = await historicalRates("2020-04-04");
  console.log(data);
})()

// Output: {motd: Object, success: true, historical: true, base: "EUR", date: "2020-04-04", rates: Object}

// Timeseries
timeseries("2020-04-04", "2021-01-01")
  .then((data) => console.log(data));
  

// Fluctuation
fluctuation("2020-04-04", "2021-01-01")
  .then((data) => console.log(data));

// Symbols
symbols().then((data) => console.log(data));

// EU Vat Rates
EUVATRates().then((data) => console.log(data));

Documentation

https://eliutgon.github.io/exchangerate-javascript-sdk

Keywords

FAQs

Last updated on 16 Oct 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc