2
0
mirror of synced 2025-02-23 19:48:28 +00:00

Normalize formatUnits to simplified decimals.

This commit is contained in:
Richard Moore 2020-07-13 07:28:56 -04:00
parent e128bfcd10
commit 79b1da130b
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

View File

@ -42,6 +42,9 @@ export function commify(value: string | number): string {
let suffix = "";
if (comps.length === 2) { suffix = "." + (comps[1] || "0"); }
while (suffix.length > 2 && suffix[suffix.length - 1] === "0") {
suffix = suffix.substring(0, suffix.length - 1);
}
const formatted = [];
while (whole.length) {