MCPcopy Create free account
hub / github.com/webpack/webpack-cli / groupBy

Method groupBy

packages/webpack-cli/src/webpack-cli.ts:1341–1351  ·  view source on GitHub ↗
(xs: Problem[], key: K)

Source from the content-addressed store, hash-verified

1339
1340 if (problems) {
1341 const groupBy = <K extends keyof Problem & StringsKeys<Problem>>(xs: Problem[], key: K) =>
1342 xs.reduce(
1343 (rv, problem) => {
1344 const path = problem[key];
1345
1346 (rv[path] ||= []).push(problem);
1347
1348 return rv;
1349 },
1350 {} as Record<string, Problem[]>,
1351 );
1352 const problemsByPath = groupBy<"path">(problems, "path");
1353
1354 for (const path in problemsByPath) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected