mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 01:23:49 +01:00
BUGFIX: Update formatPercent to not use a suffixStart of 0 (#1024)
This commit is contained in:
parent
7017f3c2f8
commit
82511e5030
@ -101,7 +101,7 @@ export function formatPercent(n: number, fractionalDigits = 2, multStart = 1e6)
|
|||||||
if (nAbs * 100 === Infinity) return n < 0 ? "-∞%" : "∞%";
|
if (nAbs * 100 === Infinity) return n < 0 ? "-∞%" : "∞%";
|
||||||
|
|
||||||
// Mult form. There are probably some areas in the game this wouldn't make sense, but they hopefully won't ever have huge %.
|
// Mult form. There are probably some areas in the game this wouldn't make sense, but they hopefully won't ever have huge %.
|
||||||
if (nAbs >= multStart) return "x" + formatNumber(n, fractionalDigits, 0);
|
if (nAbs >= multStart) return "x" + formatNumber(n, fractionalDigits);
|
||||||
|
|
||||||
return getFormatter(fractionalDigits, percentFormats, { style: "percent" }).format(n);
|
return getFormatter(fractionalDigits, percentFormats, { style: "percent" }).format(n);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user