Skip to content

Commit

Permalink
Run format
Browse files Browse the repository at this point in the history
  • Loading branch information
CRBl69 committed Oct 30, 2024
1 parent d49cd6c commit ade9d1d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/typescript/sdk/src/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
//
// In the case of 0.[0-9]+, the leading zero will not be removed.
export const trimLeadingZeros = (input: string) => {
// Replace all leading zeros with one zero
input = input
.replace(/^0+/, "0"); // The regex matches all leading 0s.
// Replace all leading zeros with one zero
input = input.replace(/^0+/, "0"); // The regex matches all leading 0s.

if (input.startsWith("0") && !input.startsWith("0.") && input.length > 1) {
input = input.slice(1);
}

return input;
}
};

// Remove all leading zeros and transform "," in ".".
//
Expand All @@ -22,7 +21,7 @@ export const sanitizeNumber = (input: string) => {
return `0${input}`;
}
return input;
}
};

// Return true if input is a number in construction.
//
Expand Down Expand Up @@ -56,4 +55,5 @@ export const isNumberInContstruction = (input: string) => /^[0-9]*(\.([0-9]*)?)?
// return 0.
//
// The regex tests if there is a dot in the string.
export const numberOfDecimals = (input: string) => /\./.test(input) ? input.split(".")[1].length : 0;
export const numberOfDecimals = (input: string) =>
/\./.test(input) ? input.split(".")[1].length : 0;

0 comments on commit ade9d1d

Please sign in to comment.