From aad653bf0bb1c0e9eca32db4436cc2e555ed050f Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Fri, 21 Jul 2023 22:55:35 -0400 Subject: [PATCH] build --- src/app/pipes/hash-suffix.pipe.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/pipes/hash-suffix.pipe.ts b/src/app/pipes/hash-suffix.pipe.ts index bb59b7b..f6a57cf 100644 --- a/src/app/pipes/hash-suffix.pipe.ts +++ b/src/app/pipes/hash-suffix.pipe.ts @@ -13,13 +13,16 @@ export class HashSuffixPipe implements PipeTransform { public transform(value: number): string { - if (value == null || value == 0) { + if (value == null || value < 0) { return '0'; } const suffixes = [' H/s', ' KH/s', ' MH/s', ' GH/s', ' TH/s', ' PH/s', ' EH/s']; - const power = Math.floor(Math.log10(value) / 3); + let power = Math.floor(Math.log10(value) / 3); + if (power < 0) { + power = 0; + } const scaledValue = value / Math.pow(1000, power); const suffix = suffixes[power];