takeUntil

 

takeUntil(otherStream) will complete when another (terminating) stream emits a value

const { rxObserver } = require('api/v0.3');
const { timer } = require('rxjs');
const { takeUntil } = require('rxjs/operators');

const source$ = timer(0, 100);
const terminator$ = timer(550);

source$.subscribe(rxObserver('source$'));
terminator$.subscribe(rxObserver('terminator$'));
source$.pipe(
    takeUntil(terminator$)
  )
  .subscribe(rxObserver('takeUntil'));

See take and takeWhile operators

And first vs take vs single comparison