How add all arrays to one in rxjs

Viewed 42

how i can add all arrays to one in rxjs for this code?

someObs$ = this.getSomeData$().pipe(
    mergeMap(res => res),
    groupBy(el => el.class),
    mergeMap(group$ => group$.pipe(toArray())),
    // how in this place create something like this: [[{},{}], [{},{}], [{},{}]]
    shareReplay(1)
  )

Thanks for help

2 Answers

I found solution for this: operator toArray()

RxJS Doc definition of toArray operator:

toArray will wait until the source Observable completes before emitting the array containing all emissions. When the source Observable errors no array will be emitted.

Marble Diagram: enter image description here

Related