import { from } from 'rxjs';
import { single } from 'rxjs/operators';
const source = from([1, 2, 3, 4, 5]);
//emit one item that matches predicate
const example = source.pipe(single(val => val === 4));
const subscribe = example.subscribe(val => console.log(val));