Refactor decimalCount method and add it on a file to be used in many components

This commit is contained in:
RcleydsonR
2023-01-18 23:38:00 -03:00
parent 4999f3d145
commit be90ff746b
4 changed files with 10 additions and 30 deletions

View File

@@ -0,0 +1,7 @@
export const decimalCount = (num: number): number => {
const numStr = String(num);
if (numStr.includes(".")) {
return numStr.split(".")[1].length;
}
return 0;
};