first
operator re-emits the first emission from the source and then completes
Also check out this
first
vstake
vssingle
head-to-head comparison
1234567891011121314151617const { rxObserver } = require('api/v0.3'); const { timer } = require('rxjs'); const { take, first } = require('rxjs/operators'); const source$ = timer(10, 10).pipe( take(10) ); const result$ = source$.pipe( first() ); source$.subscribe(rxObserver('source')); result$.subscribe(rxObserver('first()'));