Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

`Object.groupBy` and `Map.groupBy`: Stop Hand-Rolling Aggregation in 2026

DEV Community·Gabriel Anhaia·27 days ago
#1HHtCKfR
Reading 0:00
15s threshold

Book: TypeScript Essentials — From Working Developer to Confident TS, Across Node, Bun, Deno, and the Browser Also by me: The TypeScript Library — the 5-book collection My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub You open the analytics service. Somewhere in there is a function called bucketByStatus . It is fourteen lines. It declares an empty object, walks an array of orders, and pushes each order into a key on the object based on its status. The first time you see it, you read the whole thing to be sure. The next time, you skim. The third time, you write a copy of it three files away because finding the original took longer than rewriting the body. A team you talk to has six functions like this in one repo. None of them is wrong. None of them is interesting. Every one of them is a reduce with an accumulator object, an if for "have I seen this key yet," and a push. That whole pattern was retired in ES2024.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More