File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -24561,10 +24561,12 @@ var core5 = __toESM(require_core(), 1);
24561
24561
// src/common.ts
24562
24562
function formatBytes(bytes) {
24563
24563
if (bytes === 0) return "0 B";
24564
+ const absBytes = Math.abs(bytes);
24564
24565
const k = 1e3;
24565
24566
const sizes = ["B", "kB", "MB", "GB"];
24566
- const i = Math.floor(Math.log(bytes) / Math.log(k));
24567
- return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`;
24567
+ const i = Math.floor(Math.log(absBytes) / Math.log(k));
24568
+ const byteValue = parseFloat((absBytes / Math.pow(k, i)).toFixed(1));
24569
+ return `${bytes < 0 ? -byteValue : byteValue} ${sizes[i]}`;
24568
24570
}
24569
24571
24570
24572
// src/checks/dependency-size.ts
Original file line number Diff line number Diff line change 1
1
export function formatBytes ( bytes : number ) : string {
2
2
if ( bytes === 0 ) return '0 B' ;
3
+ const absBytes = Math . abs ( bytes ) ;
3
4
const k = 1000 ;
4
5
const sizes = [ 'B' , 'kB' , 'MB' , 'GB' ] ;
5
- const i = Math . floor ( Math . log ( bytes ) / Math . log ( k ) ) ;
6
- return `${ parseFloat ( ( bytes / Math . pow ( k , i ) ) . toFixed ( 1 ) ) } ${ sizes [ i ] } ` ;
6
+ const i = Math . floor ( Math . log ( absBytes ) / Math . log ( k ) ) ;
7
+ const byteValue = parseFloat ( ( absBytes / Math . pow ( k , i ) ) . toFixed ( 1 ) ) ;
8
+ return `${ bytes < 0 ? - byteValue : byteValue } ${ sizes [ i ] } ` ;
7
9
}
You can’t perform that action at this time.
0 commit comments