mirror of
https://github.com/benjamin-wilson/public-pool-ui.git
synced 2025-07-23 13:15:16 +02:00
nerdminer fix
This commit is contained in:
@@ -10,11 +10,14 @@ export class NumberSuffixPipe implements PipeTransform {
|
||||
|
||||
const suffixes = ['', 'k', 'M', 'B', 'T', 'P', 'E'];
|
||||
|
||||
if (value === 0) {
|
||||
if (value == null || value < 0) {
|
||||
return '0';
|
||||
}
|
||||
|
||||
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