Demo:  reduce

reduce accumulates the incoming values using an accumulator function and emits only after the source completes .

It also accepts an optional seed value as the initial accumulation value.

reduce( (acc,input) => accumulationFunction, seedValue);
const input = of(5, 15, 25, 40, 20)
        .pipe(concatMap(v => of(v).pipe(delay(1000))));

//accumulate and emit after the input stream completes
const process = reduce(((acc,input) => acc+input), 500);

const output=input.pipe(process).subscribe(v=>console.log(v))