Created
September 11, 2024 17:04
-
-
Save gusfune/b2ce8bf22cbc27151d4f4a296534bbec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const clearDecimals = (value: number, digits: number = 2) => { | |
if (digits === 0) { | |
return parseInt(value.toString()) | |
} | |
return Number(value.toFixed(digits)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment