Demo:  takeWhile

takeWhile take the incoming values until the given condition satisfy for the first time.

takeWhile(takeCondition)
//Emit the items every 1 sec
let input = of(2,5,4,6,5,3,2,8)
        .pipe(concatMap(v=>of(v).pipe(delay(1000))));

//take items only until the condition satisfy once
let process = takeWhile(v => (v < 6));

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