Edited formatAbsurdNumber; reinstated parts of formatShares

This commit is contained in:
Tesseract1234567890 2021-06-02 21:41:58 -04:00
parent 1b6058dd0a
commit 54114dc6d0

@ -52,7 +52,7 @@ class NumeralFormatter {
return this.format(n, "0.000a"); return this.format(n, "0.000a");
} }
formatAbsurdNumber(n: number, decimalPlaces: number): string { formatAbsurdNumber(n: number, decimalPlaces = 3): string {
for(let i = 0; i < extraFormats.length; i++) { for(let i = 0; i < extraFormats.length; i++) {
if(extraFormats[i] < n && n <= extraFormats[i]*1000) { if(extraFormats[i] < n && n <= extraFormats[i]*1000) {
return this.format(n/extraFormats[i], '0.'+'0'.repeat(decimalPlaces))+extraNotations[i]; return this.format(n/extraFormats[i], '0.'+'0'.repeat(decimalPlaces))+extraNotations[i];
@ -140,6 +140,9 @@ class NumeralFormatter {
} }
formatShares(n: number): string { formatShares(n: number): string {
if (n < 1000) {
return this.format(n, "0");
}
return this.formatAbsurdNumber(n, 3); return this.formatAbsurdNumber(n, 3);
} }