nerdminer fix

This commit is contained in:
Ben Wilson
2023-07-22 18:40:01 -04:00
parent aad653bf0b
commit fe42b01021

View File

@@ -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];