mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-09 17:23:53 +01:00
BUGFIX: formatNumber throws an error if suffixStart is too low (#957)
This commit is contained in:
parent
dd9ace7891
commit
9827fda4a4
@ -113,8 +113,11 @@ export function formatNumber(n: number, fractionalDigits = 3, suffixStart = 1000
|
||||
|
||||
// Special handling for Infinities
|
||||
if (nAbs === Infinity) return n < 0 ? "-∞" : "∞";
|
||||
if (suffixStart < 1000) {
|
||||
throw new Error("suffixStart must be greater than or equal to 1000");
|
||||
}
|
||||
|
||||
// Early return for non-suffix
|
||||
// Early return for non-suffix or if number and suffix are 0
|
||||
if (nAbs < suffixStart) {
|
||||
if (isInteger) return basicFormatter.format(n);
|
||||
return getFormatter(fractionalDigits).format(n);
|
||||
|
Loading…
Reference in New Issue
Block a user