Skip to content

money.js is a tiny (1kb) javascript currency conversion library, for web & nodeJS

License

Notifications You must be signed in to change notification settings

ducdigital/money.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

money.js / fx()

Build Status

This is a fork of money.js.

It was fork to merge several PR that important but was ignored by the author of money.js. For detailed change log, please scroll down to the Changelog section.

Quick Examples:

// Simple syntax:
fx.convert(1000, {from: "GBP", to: "HKD"});

// Method chaining:
fx(1.99).from("USD").to("AED");

// Basic parsing:
fx("$1.99 HKD").to("EUR");

// Default parameters:
fx(5318008).convert();

// Supports nodeJS / AMD:
var fx = require('money');
require(["money"], function(fx) { /* ... */ });

Additional features:

  • New instance of money.js. fx.factory()
var fx = require('money');
var newFxInstance = fx.factory();

console.log(fx === newFxInstance) // false
  • Get rate between currencies fx.getRate(to, from)
var fx = require('money');
fx.rates = { 'USD': 1, 'EUR': 0.5, 'GBP': 0.4 };

console.log(fx.getRate('EUR', 'GBP')); // 0.8

Changelog

0.3

0.2

  • Now maintained by Open Exchange Rates
  • Improved documentation

0.1.3 - Fixed typo in nodeJS module definition

0.1.2 - Strengthened up module definition similar to accounting.js

0.1.1 - Added fallback when base rate is not in rates object (e.g. "USD": 1) to avoid errors

0.1.0 - Added license; bumped version

0.0.2

  • Adds basic parsing to fx(), so that you can pass a formatted string, like so: fx("$1.99 HKD").to("GBP")
  • Some cleanup and improved comments and docs

0.0.1 - First release

About

money.js is a tiny (1kb) javascript currency conversion library, for web & nodeJS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%