I have an item object that I receive from the server. Each item and its quantity has to be saved with the seller, however, at the time of showing on the screen, I need the values to be totaled independent of the seller in a new array.
[
{ code: 1, item: 'ball', salesman: 'Braan', quantity: 5, price: 10.00},
{ code: 1, item: 'shoe', salesman: 'Alex', quantity: 5, price: 20.00},
{ code: 1, item: 'ball', salesman: 'Max', quantity: 3, price: 10.00},
{ code: 1, item: 'shirt', salesman: 'Braan', quantity: 5, price: 15.00}
]
the desired output would be:
[
{ code: 1, item: 'ball', quantity: 8, price: 20.00},
{ code: 1, item: 'shoe', quantity: 5, price: 20.00},
{ code: 1, item: 'shirt', quantity: 5, price: 15.00}
]