refactor(shared): update utilities, API layer, and types
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
/**
|
||||
* Get the number of decimal places in a number
|
||||
* Counts the number of decimal places in a number
|
||||
*
|
||||
* For example:
|
||||
* - 1 -> 0
|
||||
* - 0.1 -> 1
|
||||
* - 0.01 -> 2
|
||||
* - 0.05 -> 2
|
||||
* Returns the length of the decimal portion of a number.
|
||||
* Used to determine precision for rounding operations.
|
||||
*
|
||||
* @param step - The step number to analyze
|
||||
* @returns The number of decimal places
|
||||
* @param step - The number to analyze
|
||||
* @returns The number of decimal places (0 for integers)
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* getDecimalPlaces(1); // 0
|
||||
* getDecimalPlaces(0.1); // 1
|
||||
* getDecimalPlaces(0.01); // 2
|
||||
* getDecimalPlaces(0.005); // 3
|
||||
* ```
|
||||
*/
|
||||
export function getDecimalPlaces(step: number): number {
|
||||
const str = step.toString();
|
||||
|
||||
Reference in New Issue
Block a user