fix(config): support more values for the useSharedArrayBuffer (#3688)

This commit is contained in:
Alireza authored and GitHub committed 2023-10-03 10:11:32 -04:00
1 parent c9c57b04d3
commit 1129c155d2
22 files changed
+144 -133

No files matched your search

+7 -1
View File
@@ -5,8 +5,14 @@
* @returns The maximum number of digits required to display a value.
*/
const getMaxDigits = (maxValue: number, step: number) => {
const integerDigits = maxValue.toString().length;
if (step <= 0) {
throw new Error('Step should be greater than zero');
}
// Get the number of integer digits for maxValue
const integerDigits = maxValue.toString().split('.')[0].length;
const decimalDigits = step % 1 === 0 ? 0 : step.toString().split('.')[1].length;
return integerDigits + (decimalDigits ? decimalDigits + 1 : 0);
};