Skip to content

Commit

Permalink
Remove lodash.groupBy (#2238)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore authored Dec 30, 2024
1 parent e41d1e2 commit 9a6db2c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
14 changes: 13 additions & 1 deletion lib/support/util.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import groupBy from 'lodash.groupby';
import intel from 'intel';
const log = intel.getLogger('browsertime');

Expand Down Expand Up @@ -45,6 +44,7 @@ export function logResultLogLine(results) {
// get the id
let pageId = results.har.log.pages[index].id;
let entriesByPage = groupBy(results.har.log.entries, 'pageref');

requests = entriesByPage[pageId]
? entriesByPage[pageId].length + ' requests'
: '';
Expand Down Expand Up @@ -299,3 +299,15 @@ export function pick(obj, keys) {
}
return result;
}

function groupBy(array, property) {
const grouped = {};
for (const item of array) {
const key = item[property];
if (!grouped[key]) {
grouped[key] = [];
}
grouped[key].push(item);
}
return grouped;
}
11 changes: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"get-port": "7.1.0",
"intel": "1.2.0",
"lodash.get": "4.4.2",
"lodash.groupby": "4.6.0",
"lodash.isempty": "4.4.0",
"lodash.merge": "4.6.2",
"lodash.set": "4.3.2",
Expand Down

0 comments on commit 9a6db2c

Please sign in to comment.