Echo JS 0.11.0

<~>
alamgir72435 1886 days ago.
```

I have a problem like this .... i have a array like 1st one and need to convert into second one How can i do that ???
[
	{'bike':'Fzs', 'modelId':'5', 'red'},
	{'bike':'Fzs', 'modelId':'6', 'blue'},
	{'bike':'Fzs', 'modelId':'5', 'black'},
	{'bike':'Fzs', 'modelId':'5', 'red'},
	{'bike':'Fzs', 'modelId':'6', 'blue'},
	{'bike':'Fzs', 'modelId':'5', 'red'},
	{'bike':'Fzs', 'modelId':'7', 'black'},
	{'bike':'Fzs', 'modelId':'6', 'purple'},
	{'bike':'Fzs', 'modelId':'7', 'black'},
	{'bike':'Fzs', 'modelId':'5', 'red'}
]
***INTO***
[
	{'bike':'Fzs', 'modelId':'5', 'red', 'qty':'3'},
	{'bike':'Fzs', 'modelId':'5', 'black', 'qty':'1'},
	{'bike':'Fzs', 'modelId':'6', 'blue', 'qty':'2'},
	{'bike':'Fzs', 'modelId':'6', 'purple', 'qty':'1'},
	{'bike':'Fzs', 'modelId':'7', 'black', 'qty':'2'}
]



```

joeted 1886 days ago. link 1 point
In term of design, what you want is to perform a group by operation and probably then map it to the final datastructure (bike, modelId, color, quantity)

There are several ways to implement the two steps, including using a lib (lodash groupBy for example) or the reduce mentioned in the other comment.