I understand that for count an array in Angular with rxjs I use reduce, for example if I want count : [{id: 1, items: [10, 20, 30]}] I use the following code:
const item = from([{id: 1, items: [10, 20, 30]}]);
item.pipe(
map(actions => actions.items),
mergeAll(),
reduce((acc, i) => acc + i, 0)
).subscribe(p => console.log('Print 60: ', p));
The questions is How get make a reducer in the following array:
const items = [
{
id: 1,
boxing: [1, 2, 2]
},
{
id: 2,
boxing: [10, 10, 20]
}];
result expected:
[{
id: 1,
boxing: 5
},
{
id: 2,
boxing: 40
}]
I will appreciate your help