@quantumwake/terminal-ux-dashboard-components 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -438,17 +438,17 @@ var aggregate = (records, column, fn) => {
|
|
|
438
438
|
};
|
|
439
439
|
|
|
440
440
|
// src/format.ts
|
|
441
|
-
var BYTE_UNITS = ["KB", "MB", "GB", "TB"];
|
|
441
|
+
var BYTE_UNITS = ["KB", "MB", "GB", "TB", "PB"];
|
|
442
442
|
function formatBytes(value, perSecond = false) {
|
|
443
443
|
const suffix = perSecond ? "/s" : "";
|
|
444
444
|
if (!Number.isFinite(value)) return `\u2014 B${suffix}`;
|
|
445
445
|
const sign = value < 0 ? "-" : "";
|
|
446
446
|
const abs = Math.abs(value);
|
|
447
|
-
if (abs <
|
|
448
|
-
let scaled = abs /
|
|
447
|
+
if (abs < 1e3) return `${sign}${Math.round(abs)} B${suffix}`;
|
|
448
|
+
let scaled = abs / 1e3;
|
|
449
449
|
let unit = 0;
|
|
450
|
-
while (scaled >=
|
|
451
|
-
scaled /=
|
|
450
|
+
while (scaled >= 1e3 && unit < BYTE_UNITS.length - 1) {
|
|
451
|
+
scaled /= 1e3;
|
|
452
452
|
unit++;
|
|
453
453
|
}
|
|
454
454
|
return `${sign}${scaled.toFixed(1)} ${BYTE_UNITS[unit]}${suffix}`;
|