Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Currency-conversion with JavaScript

Monday, February 6th, 2012 by Servage
Yet another pretty little JS library offering a set of special functionality: Money.js. It’s doing what it advertises, easily and quickly. The description says:
“JavaScript currency conversion library, done right – with no dependencies, in just over 1 kb.
Designed to work seamlessly with data from the Open Source Exchange Rates API project – but can be set up to use any data source and base currency in just a few lines. And it works as a NodeJS/CJS and RequireJS/AMD module, too. Yay!”
Example code:
// From any currency, to any currency:
fx.convert(12.99, {from: "GBP", to: "HKD"});

// Chaining sugar:

// With simple settings and defaults, making this possible:

// Can also be used as a nodeJS/npm or requireJS/AMD module
var fx = require("money");
require(["money"], function(fx) { /* ... */ });

Start converting your money today ;-)

Currency-conversion with JavaScript, 5.0 out of 5 based on 2 ratings
Categories: Tips & Tricks


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.