3 ms·
What’s a listToKeyed function?
by minitech 7y ago
What’s a listToKeyed function?
- spoiler 7y agoI 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.