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);
2456124561// src/common.ts
2456224562function formatBytes(bytes) {
2456324563 if (bytes === 0) return "0 B";
24564+ const absBytes = Math.abs(bytes);
2456424565 const k = 1e3;
2456524566 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]}`;
2456824570}
2456924571
2457024572// src/checks/dependency-size.ts
Original file line number Diff line number Diff line change 11export function formatBytes ( bytes : number ) : string {
22 if ( bytes === 0 ) return '0 B' ;
3+ const absBytes = Math . abs ( bytes ) ;
34 const k = 1000 ;
45 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 ] } ` ;
79}
You can’t perform that action at this time.
0 commit comments