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

currency symbol position option #5

Closed tombiscan closed 13 years ago

tombiscan commented 13 years ago

Please add another option for formatting: currency symbol position - "before" (default) and "after" the number ($123 vs 123$). Example:

wjcrowcroft commented 13 years ago

Hey, actually this is already an option, although the lack of documentation doesn't make it easy to spot (you'd have to look in the demo and library source to find it)

accounting.formatColumn(numbers, {
    symbol : " GBP",
    symbolAfter : true
}),

I was hesitant to keep adding new options as extra params to avoid parameter bloat, so this is the first step to ditching that way entirely and just always using the object as second parameter pattern.

This will definitely be resolved one way or the other in 0.2, but for now, the 2nd-param-object format will work for this. Thanks!

tombiscan commented 13 years ago

Sorry, didn't look at the source, just the examples :( Thanks.

wjcrowcroft commented 13 years ago

No worries! It wasn't very clear.