|
87 | 87 | numeral._ = _ = { |
88 | 88 | // formats numbers separators, decimals places, signs, abbreviations |
89 | 89 | numberToFormat: function (value, format, roundingFunction) { |
90 | | - var locale = locales[numeral.options.currentLocale], negP = false, optDec = false, leadingCount = 0, abbr = '', trillion = 1000000000000, billion = 1000000000, million = 1000000, thousand = 1000, decimal = '', neg = false, abbrForce, abs, int, precision, signed, thousands, output; |
| 90 | + var locale = locales[numeral.options.currentLocale], negP = false, optDec = false, leadingCount = 0, abbr = '', trillion = 1000000000000, billion = 1000000000, million = 1000000, thousand = 1000, decimal = '', neg = false, abbrForce, abs, int, precision, signed = -1, thousands, output; |
91 | 91 | // make sure we never format a null value |
92 | 92 | value = value || 0; |
93 | 93 | abs = Math.abs(value); |
|
307 | 307 | * problems for accounting- and finance-related software. |
308 | 308 | */ |
309 | 309 | toFixed: function (value, maxDecimals, roundingFunction, optionals) { |
310 | | - var splitValue = value.toString().split('.'), minDecimals = maxDecimals - (optionals || 0), boundedPrecision, optionalsRegExp, power, output; |
| 310 | + optionals = optionals || 0; |
| 311 | + var splitValue = value.toString().split('.'), minDecimals = maxDecimals - optionals, boundedPrecision, optionalsRegExp, power, output; |
311 | 312 | // Use the smallest precision value possible to avoid errors from floating point representation |
312 | 313 | if (splitValue.length === 2) { |
313 | 314 | boundedPrecision = Math.min(Math.max(splitValue[1].length, minDecimals), maxDecimals); |
|
0 commit comments