/*! * accounting.js v0.3.2 * Copyright 2011, Joss Crowcroft * * Freely distributable under the MIT license. * Portions of accounting.js are inspired or borrowed from underscore.js * * Full details and documentation: * http://josscrowcroft.github.com/accounting.js/ */(function(e,t){function o(e){return!!(e===""||e&&e.charCodeAt&&e.substr)}function u(e){return i?i(e):s.call(e)==="[object Array]"}function a(e){return e&&s.call(e)==="[object Object]"}function f(e,t){var n;e=e||{};t=t||{};for(n in t)t.hasOwnProperty(n)&&e[n]==null&&(e[n]=t[n]);return e}function l(e,t,n){var i=[],s,o;if(!e)return i;if(r&&e.map===r)return e.map(t,n);for(s=0,o=e.length;s3?m.length%3:0;return h+(g?m.substr(0,g)+s.thousand:"")+m.substr(g).replace(/(\d{3})(?=\d)/g,"$1"+s.thousand)+(o?s.decimal+d(Math.abs(e),o).split(".")[1]:"")},m=n.formatMoney=function(e,t,r,i,s,o){if(u(e))return l(e,function(e){return m(e,t,r,i,s,o)});e=p(e);var d=f(a(t)?t:{symbol:t,precision:r,thousand:i,decimal:s,format:o},n.settings.currency),g=h(d.format),y=e>0?g.pos:e<0?g.neg:g.zero;return y.replace("%s",d.symbol).replace("%v",v(Math.abs(e),c(d.precision),d.thousand,d.decimal))};n.formatColumn=function(e,t,r,i,s,d){if(!e)return[];var m=f(a(t)?t:{symbol:t,precision:r,thousand:i,decimal:s,format:d},n.settings.currency),g=h(m.format),y=g.pos.indexOf("%s")0?g.pos:e<0?g.neg:g.zero,i=r.replace("%s",m.symbol).replace("%v",v(Math.abs(e),c(m.precision),m.thousand,m.decimal));i.length>b&&(b=i.length);return i});return l(w,function(e,t){return o(e)&&e.length