I would like to get an array of arrays like ...[[1,2],[5,8],[9]]... depending on the group by.
This is the example I am following from the rxjs library example. This ex only uses one property to group by.
Observable.of<Obj>({id: 1, age: 5, weight: 145},
{id: 9, age: 7, weight: 10},
{id: 2, age: 5, weight: 145},
{id: 60, age: 11, weight: 145},
)
.groupBy(p => p.id)
.flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], []))
.subscribe(p => console.log(p));
Expected result: [[1,2],[9],[60]]
I haven't managed to make it work with more than one property (age and weight).
Could anybody tell me how I can achieve this?
Thanks,