Demo: distinctUntilChanged
distinctUntilChanged ensures that the consequtively emitted values are always distinct.
distinctUntilChanged()
//concatMap delays each item by 1sec to avoid display overlap
let input = of(2,5,6,5,5,6,6,3,8)
.pipe(concatMap(v=>of(v).pipe(delay(1000))));
//ensures that the consequtively emitted values are distinct.
let process = distinctUntilChanged();
let output = input.pipe(process).subscribe(v=>console.log(v))