handle negative resources in account
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
83a310095f
commit
7a4216e255
@ -49,7 +49,10 @@ function parseNumber(value, unitData) {
|
|||||||
let multiplier = unitData.multiplier;
|
let multiplier = unitData.multiplier;
|
||||||
let unit = unitData.unit;
|
let unit = unitData.unit;
|
||||||
value = multiplier * value;
|
value = multiplier * value;
|
||||||
if (compact) {
|
if (value <= 0) {
|
||||||
|
return `0 ${unit}`;
|
||||||
|
}
|
||||||
|
else if (compact) {
|
||||||
let exponent = Math.floor(Math.log2(value) / 10);
|
let exponent = Math.floor(Math.log2(value) / 10);
|
||||||
value = value / 1024 ** exponent;
|
value = value / 1024 ** exponent;
|
||||||
let unitPrefix = SIPrefix[exponent];
|
let unitPrefix = SIPrefix[exponent];
|
||||||
|
Loading…
Reference in New Issue
Block a user