mirror of
https://github.com/benjamin-wilson/public-pool-ui.git
synced 2025-07-28 15:42:11 +02:00
build
This commit is contained in:
@@ -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];
|
||||
|
||||
|
Reference in New Issue
Block a user