Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

money-converter

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

money-converter

A npm module that looks at mutliple exchanges when determining the fx rate

  • 1.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

Money Converter

There are plenty of currency converter packages out there, each getting their conversion rates from different places. Money Converter looks at multiple sources to ensure that you always have the most accurate exchange rate avaialable. Its fast, simple, light weight and most importantly, fault resistant.

Install

npm install money-converter

Usage

To make sure that money-converter is as fast as possible, you pass it in an array of currencies and a bse currency. money-converter will then load the conversion rate between your base currency and each of the other currencies. This async process must be completed before the module can be used

we're going to be using the popular async module here for demonstation of how load the currencies before using them

make sure to include the base currency in the list of currencies you pass into the constructor

var MoneyConverter = require('monver-converter');
var async = require('async');

var money;

async.series([

  // load and cache currency conversions
  // the base currency is USD
  function(done) {
    money = new MoneyConverter('USD', ['CAD', 'GBP', 'EUR', 'USD'], done)
  }

  // example of how we want to actually use it
  function(done) {

    money.convert(1000, {from: 'USD', to: 'EUR'});
    // => 914

    money.convert(10, {from: 'CAD', to: 'EUR'});
    // => 6.655501347120076

    money.convert(1, {from: 'GBP', to: 'USD'});
    // => 1.50534397109739

    done();
  }
]);

Keywords

FAQs

Package last updated on 29 Dec 2015

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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc