| 341 | if (errors && errors.length > 0) return formatError(errors); |
| 342 | return ['UnexpectedSuccess', strip(operands(value).length === 1 ? operand(value, 1)! : value) ?? 'Missing']; |
| 343 | } |
| 344 | |
| 345 | function memToString(n: number): string { |
| 346 | if (n < 1024) return n.toFixed() + ' bytes'; |
| 347 | n /= 1024; |
| 348 | if (n < 1024) return n.toFixed(1) + ' kB'; |
| 349 | n /= 1024; |
| 350 | if (n < 1024) return n.toFixed(1) + ' MB'; |
| 351 | n /= 1024; |
| 352 | if (n < 1024) return n.toFixed(1) + ' GB'; |
| 353 | n /= 1024; |
| 354 | return n.toFixed(2) + ' TB'; |
| 355 | } |
| 356 | |