Giter VIP home page Giter VIP logo

npm-currency-converter's Introduction

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

npm-currency-converter's People

Contributors

dmamaril avatar

Stargazers

Simon Thiboutôt avatar Norman Sue avatar  avatar  avatar

Watchers

 avatar

npm-currency-converter's Issues

Fails to offer viable rate due to rounding

Example: IDR -> USD ... gets rounded down to 0

Expected: IDR -> USD should produce something like 0.00007

Solution: provide option for rounding and only round rates when requested.

Expose currency data

Enhancement: expose the currency data inside the library.

Currently it's not exported at the top level.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.