handle negative resources in account
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
bcc7e0ea57
commit
938741d429
@ -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