I have an array of objects with the following format
[{'list': 'one', 'item': 1}, {'list': 'one', 'item': 2}, {'list': 'one', 'item': 3}, {'list': 'two', 'item': 1}, {'list': 'two', 'item': 2}]
And I want to convert it like this
[{'one': [1, 2, 3]}, {'two': [1, 2]}]
How can I do this using the Array.map function? Is this the best alternative?
source share