Skip to content

Commit d212f7e

Browse files
requested changes - check str length in removeLeadingZerosAndExplicitPlus
1 parent 63beeea commit d212f7e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/utils/string_utils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ export function removeLeadingZerosAndExplicitPlus(str: string): string {
1818

1919
let foundInsignificantZero = false;
2020

21-
while (str[startIndex] === '0') {
21+
for (; startIndex < str.length && str[startIndex] === '0'; ++startIndex) {
2222
foundInsignificantZero = true;
23-
startIndex += 1;
2423
}
2524

2625
if (!foundInsignificantZero) {

0 commit comments

Comments
 (0)