refactor(shared): update utilities, API layer, and types

This commit is contained in:
Ilia Mashkov
2026-03-02 22:19:13 +03:00
parent ac73fd5044
commit 13818d5844
17 changed files with 554 additions and 96 deletions
@@ -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();