Skip to content

Commit 170fdf8

Browse files
refactor: use native padStart() in padLeftZeros utility (#4202)
Co-authored-by: Andrei Zhaleznichenka <zhalea@amazon.de>
1 parent 4129df4 commit 170fdf8

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/internal/utils/strings/pad-left-zeros.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@
55
* Prefixes given text with zeros until it reaches the target length.
66
*/
77
export function padLeftZeros(text: string, length: number): string {
8-
while (text.length < length) {
9-
text = `0${text}`;
10-
}
11-
return text;
8+
return text.padStart(length, '0');
129
}

0 commit comments

Comments
 (0)