1 |
- {"version":3,"file":"distinctUntilChanged.js","sourceRoot":"","sources":["../../src/operator/distinctUntilChanged.ts"],"names":[],"mappings":";AAEA,qCAAoD,mCAAmC,CAAC,CAAA;AAKxF,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,8BAAgE,OAAiC,EAAE,WAAyB;IAC1H,MAAM,CAAC,2CAAW,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAFe,4BAAoB,uBAEnC,CAAA","sourcesContent":["\nimport { Observable } from '../Observable';\nimport { distinctUntilChanged as higherOrder } from '../operators/distinctUntilChanged';\n\n/* tslint:disable:max-line-length */\nexport function distinctUntilChanged<T>(this: Observable<T>, compare?: (x: T, y: T) => boolean): Observable<T>;\nexport function distinctUntilChanged<T, K>(this: Observable<T>, compare: (x: K, y: K) => boolean, keySelector: (x: T) => K): Observable<T>;\n/* tslint:enable:max-line-length */\n\n/**\n * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item.\n *\n * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted.\n *\n * If a comparator function is not provided, an equality check is used by default.\n *\n * @example <caption>A simple example with numbers</caption>\n * Observable.of(1, 1, 2, 2, 2, 1, 1, 2, 3, 3, 4)\n * .distinctUntilChanged()\n * .subscribe(x => console.log(x)); // 1, 2, 1, 2, 3, 4\n *\n * @example <caption>An example using a compare function</caption>\n * interface Person {\n * age: number,\n * name: string\n * }\n *\n * Observable.of<Person>(\n * { age: 4, name: 'Foo'},\n * { age: 7, name: 'Bar'},\n * { age: 5, name: 'Foo'})\n * { age: 6, name: 'Foo'})\n * .distinctUntilChanged((p: Person, q: Person) => p.name === q.name)\n * .subscribe(x => console.log(x));\n *\n * // displays:\n * // { age: 4, name: 'Foo' }\n * // { age: 7, name: 'Bar' }\n * // { age: 5, name: 'Foo' }\n *\n * @see {@link distinct}\n * @see {@link distinctUntilKeyChanged}\n *\n * @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source.\n * @return {Observable} An Observable that emits items from the source Observable with distinct values.\n * @method distinctUntilChanged\n * @owner Observable\n */\nexport function distinctUntilChanged<T, K>(this: Observable<T>, compare?: (x: K, y: K) => boolean, keySelector?: (x: T) => K): Observable<T> {\n return higherOrder(compare, keySelector)(this);\n}\n"]}
|