MCPcopy Create free account
hub / github.com/NathanPB/progress.js / formatNumber

Function formatNumber

src/utils.ts:12–16  ·  view source on GitHub ↗
(value: number, { decimalDigits = 0, padDigits = 0 }: NumberFormat)

Source from the content-addressed store, hash-verified

10
11export type NumberFormat = { decimalDigits?: number, padDigits?: number }
12export 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}

Callers 7

utils.test.tsFile · 0.90
elapsedTimeFunction · 0.90
progressFunction · 0.90
currentFunction · 0.90
totalFunction · 0.90
rateFunction · 0.90
etaFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected