RoundDown option removed

This commit is contained in:
Anarios committed 2022-07-28 22:18:42 +02:00
1 parent 752edcc27f
commit 8e376f6142
8 files changed
+17 -103

No files matched your search

+1 -15
View File
@@ -1,22 +1,8 @@
import { extConfig } from "./state";
function roundDown(num) {
if (num < 1000) return num;
const int = Math.floor(Math.log10(num) - 2);
const decimal = int + (int % 3 ? 1 : 0);
const value = Math.floor(num / 10 ** decimal);
return value * 10 ** decimal;
}
function numberFormat(numberState) {
let numberDisplay;
if (extConfig.numberDisplayRoundDown === false) {
numberDisplay = numberState;
} else {
numberDisplay = roundDown(numberState);
}
return getNumberFormatter(extConfig.numberDisplayFormat).format(
numberDisplay
numberState
);
}