(num, digits)
| 3 | } |
| 4 | |
| 5 | export function shortenLargeNumber(num, digits) { |
| 6 | var units = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'], |
| 7 | decimal; |
| 8 | |
| 9 | for (var i = units.length - 1; i >= 0; i--) { |
| 10 | decimal = Math.pow(1000, i + 1); |
| 11 | |
| 12 | if (num <= -decimal || num >= decimal) { |
| 13 | return +(num / decimal).toFixed(digits) + units[i]; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | return num; |
| 18 | } |
nothing calls this directly
no outgoing calls
no test coverage detected