2.0.0 • Published 4 years ago

@techhof-ab/currency-converter v2.0.0

Weekly downloads
96
License
MIT
Repository
-
Last release
4 years ago

Currency Converter

A library that convert amount to other currency with the rate of input date using exchangeratesapi.io API

Installation

yarn add @techhof-ab/currency-converter

Usage

import CurrencyConverter from '@snushof-ab/currency-converter';
const res = await CurrencyConverter(100, "USD", "CAD", "2011-06-03");

console.log(res);

Inputs

  • amount - (Number) base amount
  • currencyFrom - (String) base currency code
  • currencyTo - (String) conversion currency code
  • date - (String) base date

Output

  • JSON formatted object with input data and converted base_amount
  • example { date: '2011-06-03', base_currency: 'USD', base_amount: 100, conversion_currency: 'CAD', conversion_amount: 97.85 }

Test

yarn test