The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Filtering operators: distinct and distinctUntilChanged

Filtering operators: distinct and distinctUntilChanged

4:34
Operator distinct() and its variants are an important type of Filtering operator. This lessons shows how they work and in what cases are they useful.
Watch this lesson now
Avatar
egghead.io

Operator distinct() and its variants are an important type of Filtering operator. This lessons shows how they work and in what cases are they useful.

Avatar
Jon

For people using TypeScript, you have have to import 'rxjs/add/operator/distinct'; Distinct was not included when importing 'rxjs/Rx'; and my build was erroring out.

Avatar
Mike
var result = foo.distinct((x,y) => x.toLowerCase() === y.toLowerCase());

gives: "error: TypeError: y is undefined"

Should be:

var result = foo.distinct((x) => x.toLowerCase());
Avatar
Andre

Hi Mike. That's correct. We should update the lesson to use a 'keySelector' function, not a 'compare' function.

In reply to Mike
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?