Socket
Book a DemoInstallSign in
Socket

currency-converter

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

currency-converter

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

latest
Source
npmnpm
Version
0.1.12
Version published
Maintainers
1
Created
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

currency

FAQs

Package last updated on 02 Sep 2014

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.