Beta (still building)

distinctUntilChanged

distinctUntilChanged operator only returns the emits value with compared values is distinct.

you can pass compare function, only return emit value when this function return false, see this example

Example: distinctUntilChanged simple compare

Works same than distinct operator

import { interval, of } from 'rxjs';
import { distinctUntilChanged, concatMap, delay } from 'rxjs/operators';

const values = [0, 0, 1, 1, 2, 3, 1, 1]
const source$ = of(...values).pipe(
  concatMap( i => of(i).pipe(delay(1000)))
)

const result$ = source$.pipe(distinctUntilChanged());

Example: with compare function

you can personalize the compare function, when compare function returns false it will emit the value.

import { interval, of } from 'rxjs';
import { distinctUntilChanged, map, concatMap, delay } from 'rxjs/operators';

const values = [
  {name: 'Foo'},
  {name: 'Foo'},
  {name: 'Bar'},
  {name: 'Fiz'},
]
const source$ = of(...values).pipe(concatMap( i => of(i).pipe(delay(1000))))

const compare = (prev, curr) => prev.name === curr.name

const result$ = source$.pipe(
  distinctUntilChanged(compare), 
  map(value => value.name),
);

Official Doc: rxjs.distinctUntilChanged