openexchangerates / accounting.js

A lightweight JavaScript library for number, money and currency formatting - fully localisable, zero dependencies.
http://openexchangerates.github.io/accounting.js
MIT License
4.95k stars 532 forks source link

accounting.js jQuery wrapper #29

Closed mcordingley closed 12 years ago

mcordingley commented 12 years ago

I created a jQuery wrapper for the accounting.js core. Both accounting.js and accounting-jquery.js need to be included. Functions are referenced in the standard jQuery way. e.g. $('.testClass').accounting('formatCurrency', { symbol: '?!' });

Tested and looks good from my end. Cheers!

wjcrowcroft commented 12 years ago

Hey! Thanks for doing this, it looks great so far, haven't had a chance to test it.

I'll probably merge it into dev for testing and adding some extra commits - will get back to you once I've played around with it.

Cheers!

wjcrowcroft commented 12 years ago

Hey, sorry haven't had a chance to test this out yet - will be on it tomorrow.

mcordingley commented 12 years ago

Sounds great. Thanks!

mcordingley commented 12 years ago

Sorry that this bug-fix is included in this pull request. After this is all merged in, I'll split off specific-purpose branches from master (or should it be dev?) for any future modifications.

wjcrowcroft commented 12 years ago

Ah, good catch, thanks.

I wanted to wait until I put out the alpha of version 0.3 (pushed this morning) before testing and merging the jquery wrapper, but I'll add this fix later this evening. Cheers.

mcordingley commented 12 years ago

Hey Joss, how does it look so far?

wjcrowcroft commented 12 years ago

Hey mate, Yeah was playing around with it on the flight - seems to be great. I'll merge it into dev for now while we write some tests for it (need to give the test suite a refresh generally, too).

Thanks!

mcordingley commented 12 years ago

Sounds great. I realized only after commenting that you were on a plane for almost a whole day. I haven't dug into your test suite yet, so I have no idea how that is set up. I'll check in on it sometime later, when I have more time. For now, must work.

wjcrowcroft commented 12 years ago

Hey, no worries.

I've merged your work into the dev branch for now and done a bit of tidying up / optimisation on the methods. Most notably: removed a few accidental globals, and most of the var declarations weren't needed since the values from one can be piped directly into another, which prevents unnecessary referencing - hopefully without impacting readability too much. And added file info at the top.

I've placed it in the extensions directory alongside accounting-units.js.

Thanks for the great work - I'll update the test suite soon and put it into the master branch at the next tagged release!

mcordingley commented 12 years ago

I'm glad to hear it. Thanks!