mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
fix numeralWrapper should not return NaN anymore as it'll default to 1e+X.
This commit is contained in:
parent
670394ca2f
commit
26149d5a01
@ -37,7 +37,12 @@ class NumeralFormatter {
|
|||||||
format(n: number, format: string): string {
|
format(n: number, format: string): string {
|
||||||
// numeraljs doesnt properly format numbers that are too big or too small
|
// numeraljs doesnt properly format numbers that are too big or too small
|
||||||
if (Math.abs(n) < 1e-6) { n = 0; }
|
if (Math.abs(n) < 1e-6) { n = 0; }
|
||||||
return numeral(n).format(format);
|
console.log(`${n}: ${numeral(n).format(format)}`);
|
||||||
|
const answer = numeral(n).format(format);
|
||||||
|
if (answer === 'NaN') {
|
||||||
|
return `${n}`;
|
||||||
|
}
|
||||||
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
formatBigNumber(n: number): string {
|
formatBigNumber(n: number): string {
|
||||||
|
Loading…
Reference in New Issue
Block a user