diff --git a/source/Ox/js/Format.js b/source/Ox/js/Format.js index e04143e6..22703e72 100644 --- a/source/Ox/js/Format.js +++ b/source/Ox/js/Format.js @@ -8,12 +8,12 @@ Ox.formatArea Formats a number of meters as square meters or kilometers '1 km\u00B2' @*/ -Ox.formatArea = function(num, dec) { - dec = Ox.isUndefined(dec) ? 8 : dec; - var km = num >= 1000000; +Ox.formatArea = function(number, decimals) { + var k = number >= 1000000 ? 'k' : ''; + decimals = Ox.isUndefined(decimals) ? 8 : decimals; return Ox.formatNumber( - (km ? num / 1000000 : num).toPrecision(dec) - ) + ' ' + (km ? 'k' : '') + 'm\u00B2'; + (k ? number / 1000000 : number).toPrecision(decimals) + ) + ' ' + k + 'm\u00B2'; }; /*@ @@ -21,9 +21,8 @@ Ox.formatCurrency Formats a number with a currency symbol > Ox.formatCurrency(1000, '$', 2) '$1,000.00' @*/ - -Ox.formatCurrency = function(num, str, dec) { - return str + Ox.formatNumber(num, dec); +Ox.formatCurrency = function(number, string, decimals) { + return string + Ox.formatNumber(number, decimals); }; /*@ @@ -32,10 +31,10 @@ Ox.formatDate Formats a date according to a format string strftime and ISO 8601. '%Q' (quarter) and '%X'/'%x' (year with 'BC'/'AD') are non-standard - (str) -> formatted date - (date, str) -> formatted date - (date, str, utc) -> formatted date - str format string + (string) -> formatted date + (date, string) -> formatted date + (date, string, utc) -> formatted date + string format string date date utc date is utc