feat: move functions to separate files
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Get the number of decimal places in a number
|
||||
*
|
||||
* For example:
|
||||
* - 1 -> 0
|
||||
* - 0.1 -> 1
|
||||
* - 0.01 -> 2
|
||||
* - 0.05 -> 2
|
||||
*
|
||||
* @param step - The step number to analyze
|
||||
* @returns The number of decimal places
|
||||
*/
|
||||
export function getDecimalPlaces(step: number): number {
|
||||
const str = step.toString();
|
||||
const decimalPart = str.split('.')[1];
|
||||
return decimalPart ? decimalPart.length : 0;
|
||||
}
|
||||
Reference in New Issue
Block a user