(value: number, { decimalDigits = 0, padDigits = 0 }: NumberFormat)
| 10 | |
| 11 | export type NumberFormat = { decimalDigits?: number, padDigits?: number } |
| 12 | export function formatNumber(value: number, { decimalDigits = 0, padDigits = 0 }: NumberFormat): string { |
| 13 | return value |
| 14 | .toFixed(decimalDigits) |
| 15 | .padStart(padDigits + decimalDigits + (decimalDigits > 0 ? 1 : 0), '0') |
| 16 | } |
no outgoing calls
no test coverage detected