4 ms·
I think they mean something that turns a list (array) of unique elements into a keyed collection (like a map or an object). So something like: [ {id:
by spoiler 7y ago
I think they mean something that turns a list (array) of unique elements into a keyed collection (like a map or an object). So something like:
[
{id: 1, name: 'Jane'},
{id: 2, name: 'John'}
]
becomes
{
1: {id: 1, name: 'Jane'},
2: {id: 2, name: 'John'}
}
- imtringued 7y agoThis is driving me mad. This operation is called groupBy and it is a solved problem. How on earth is HN oblivious to such a fundamental operation?
- minitech 7y agoWho’s HN here? What’s driving you mad? Not really clear what your point is.