MCPcopy
hub / github.com/date-fns/date-fns / addLeadingZeros

Function addLeadingZeros

pkgs/core/src/_lib/addLeadingZeros/index.ts:1–5  ·  view source on GitHub ↗
(number: number, targetLength: number)

Source from the content-addressed store, hash-verified

1export function addLeadingZeros(number: number, targetLength: number): string {
2 const sign = number < 0 ? "-" : "";
3 const output = Math.abs(number).toString().padStart(targetLength, "0");
4 return sign + output;
5}

Callers 15

test.tsFile · 0.90
generateOffsetFunction · 0.90
yFunction · 0.90
MFunction · 0.90
dFunction · 0.90
hFunction · 0.90
HFunction · 0.90
mFunction · 0.90
sFunction · 0.90
SFunction · 0.90
index.tsFile · 0.90
formatTimezoneShortFunction · 0.90

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected