Skip to content

Commit

Permalink
Invert result table
Browse files Browse the repository at this point in the history
  • Loading branch information
david-szabo97 committed Nov 9, 2020
1 parent 64fe832 commit ac3f077
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,21 @@ async function runPerformanceTests( branches, options ) {
log( '\n>> 🎉 Results.\n' );
for ( const testSuite of testSuites ) {
log( `\n>> ${ testSuite }\n` );
console.table( results[ testSuite ] );

/** @type {Record<string, Record<string, string>>} */
const invertedResult = {};
Object.entries( results[ testSuite ] ).reduce(
( acc, [ key, val ] ) => {
for ( const entry of Object.keys( val ) ) {
if ( ! acc[ entry ] ) acc[ entry ] = {};
// @ts-ignore
acc[ entry ][ key ] = val[ entry ];
}
return acc;
},
invertedResult
);
console.table( invertedResult );
}
}

Expand Down

0 comments on commit ac3f077

Please sign in to comment.