Skip to content

Commit

Permalink
Remove lodash mapKeys usage
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jan 31, 2023
1 parent b329b48 commit 0bd0a61
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions bin/log-perormance-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
const fs = require( 'fs' );
const path = require( 'path' );
const https = require( 'https' );
const { mapKeys } = require( 'lodash' );
const [ token, branch, hash, baseHash, timestamp ] = process.argv.slice( 2 );

const resultsFiles = [
Expand Down Expand Up @@ -39,20 +38,27 @@ const data = new TextEncoder().encode(
metrics: resultsFiles.reduce( ( result, { metricsPrefix }, index ) => {
return {
...result,
...mapKeys(
performanceResults[ index ][ hash ],
( _, key ) => metricsPrefix + key
...Object.keys( performanceResults[ index ][ hash ] ).reduce(
( accumulator, key ) => {
accumulator[ metricsPrefix + key ] =
performanceResults[ index ][ hash ][ key ];
return accumulator;
},
{}
),
};
}, {} ),
} ),
baseMetrics: resultsFiles.reduce(
( result, { metricsPrefix }, index ) => {
return {
...result,
...mapKeys(
performanceResults[ index ][ baseHash ],
( _, key ) => metricsPrefix + key
),
...Object.keys(
performanceResults[ index ][ baseHash ]
).reduce( ( accumulator, key ) => {
accumulator[ metricsPrefix + key ] =
performanceResults[ index ][ hash ][ key ];
return accumulator;
}, {} ),
};
},
{}
Expand Down

0 comments on commit 0bd0a61

Please sign in to comment.