Skip to content

Commit 4476f5d

Browse files
authored
Workflow: Improved report-size readability (#29327)
* Workflow: Improved report-size readability. * no message * no message
1 parent 429d6ff commit 4476f5d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

test/treeshake/utils/format-size.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
import { formatBytes } from './formatBytes.js';
33

44
const n = Number( process.argv[ 2 ] );
5-
const formatted = formatBytes( n );
5+
const formatted = formatBytes( n, 2, false );
66

77
console.log( formatted );

test/treeshake/utils/formatBytes.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function formatBytes( bytes, decimals = 1 ) {
1+
export function formatBytes( bytes, decimals = 1, units = true ) {
22

33
if ( bytes === 0 ) return '0 B';
44

@@ -8,6 +8,6 @@ export function formatBytes( bytes, decimals = 1 ) {
88

99
const i = Math.floor( Math.log( bytes ) / Math.log( k ) );
1010

11-
return parseFloat( ( bytes / Math.pow( k, i ) ).toFixed( dm ) ) + ' ' + sizes[ i ];
11+
return parseFloat( ( bytes / Math.pow( k, i ) ).toFixed( dm ) ) + ( units ? ' ' + sizes[ i ] : '' );
1212

1313
}

0 commit comments

Comments
 (0)