Socket
Socket
Sign inDemoInstall

currency-converter

Package Overview
Dependencies
48
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    currency-converter

currency-converter ==================


Version published
Weekly downloads
81
increased by523.08%
Maintainers
1
Install size
4.24 MB
Created
Weekly downloads
 

Readme

Source

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 ```

Keywords

FAQs

Last updated on 02 Sep 2014

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