distinctUntilKeyChanged.js.map 3.0KB

1
  1. {"version":3,"file":"distinctUntilKeyChanged.js","sourceRoot":"","sources":["../../src/operator/distinctUntilKeyChanged.ts"],"names":[],"mappings":";AAEA,wCAAuD,sCAAsC,CAAC,CAAA;AAK9F,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,iCAAgE,GAAW,EAAE,OAAiC;IAC5G,MAAM,CAAC,iDAAW,CAAO,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC;AAFe,+BAAuB,0BAEtC,CAAA","sourcesContent":["\nimport { Observable } from '../Observable';\nimport { distinctUntilKeyChanged as higherOrder } from '../operators/distinctUntilKeyChanged';\n\n/* tslint:disable:max-line-length */\nexport function distinctUntilKeyChanged<T>(this: Observable<T>, key: string): Observable<T>;\nexport function distinctUntilKeyChanged<T, K>(this: Observable<T>, key: string, compare: (x: K, y: K) => boolean): 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 * using a property accessed by using the key provided to check if the two items are distinct.\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>An example comparing the name of persons</caption>\n *\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 * .distinctUntilKeyChanged('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 * @example <caption>An example comparing the first letters of the name</caption>\n *\n * interface Person {\n * age: number,\n * name: string\n * }\n *\n * Observable.of<Person>(\n * { age: 4, name: 'Foo1'},\n * { age: 7, name: 'Bar'},\n * { age: 5, name: 'Foo2'},\n * { age: 6, name: 'Foo3'})\n * .distinctUntilKeyChanged('name', (x: string, y: string) => x.substring(0, 3) === y.substring(0, 3))\n * .subscribe(x => console.log(x));\n *\n * // displays:\n * // { age: 4, name: 'Foo1' }\n * // { age: 7, name: 'Bar' }\n * // { age: 5, name: 'Foo2' }\n *\n * @see {@link distinct}\n * @see {@link distinctUntilChanged}\n *\n * @param {string} key String key for object property lookup on each item.\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 based on the key specified.\n * @method distinctUntilKeyChanged\n * @owner Observable\n */\nexport function distinctUntilKeyChanged<T>(this: Observable<T>, key: string, compare?: (x: T, y: T) => boolean): Observable<T> {\n return higherOrder<T, T>(key, compare)(this);\n}\n"]}