(grouping, thousands)
| 9505 | } |
| 9506 | |
| 9507 | function formatGroup(grouping, thousands) { |
| 9508 | return function(value, width) { |
| 9509 | var i = value.length, |
| 9510 | t = [], |
| 9511 | j = 0, |
| 9512 | g = grouping[0], |
| 9513 | length = 0; |
| 9514 | |
| 9515 | while (i > 0 && g > 0) { |
| 9516 | if (length + g + 1 > width) g = Math.max(1, width - length); |
| 9517 | t.push(value.substring(i -= g, i + g)); |
| 9518 | if ((length += g + 1) > width) break; |
| 9519 | g = grouping[j = (j + 1) % grouping.length]; |
| 9520 | } |
| 9521 | |
| 9522 | return t.reverse().join(thousands); |
| 9523 | }; |
| 9524 | } |
| 9525 | |
| 9526 | function formatNumerals(numerals) { |
| 9527 | return function(value) { |
no test coverage detected