Skip to content

GarrettGoody/npm-currency-converter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm-currency-converter

Conversion rates between currencies and rate conversion!

Start

Register for your openexchangerates. install the package ``` npm install currency-converter ``` require the module. NOTE: Default fetchInterval value is set to one hour. ``` var cc = require('currency-converter')({ CLIENTKEY: YOUR_OPEN_EXCHANGE_RATES_KEY, [fetchInterval: 3600000] }); ```

Usage

This module makes it extremely easy for you to convert currencies. The very basic input takes in two parameters. convertFrom & convertTo have to be valid country codes. See list here. The module fetches live rates on initialize, saves it locally, and retrieves locally saved rates by default, unless otherwise specificed.

.convert(amount, convertFrom, convertTo, [live])

converts an amount specificed to a specific currency. live is an optional parameter that uses live rates from openexchangerates.org
{
    "currency": "EUR",
    "symbol": "€",
    "amount": 0.76
}

.rates(convertFrom, convertTo, [live])

returns the conversion rate between two currencies. ``` .rates('USD', 'EUR') // => 0.76 ```

About

Get conversion rates and convert them!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%