1
  1. {"version":3,"file":"find.js","sourceRoot":"","sources":["../../src/operator/find.ts"],"names":[],"mappings":";AACA,qBAAoC,mBAAmB,CAAC,CAAA;AASxD,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,cAA6C,SAAsE,EAC3F,OAAa;IACnC,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC;AAHe,YAAI,OAGnB,CAAA","sourcesContent":["import { Observable } from '../Observable';\nimport { find as higherOrder } from '../operators/find';\n\n/* tslint:disable:max-line-length */\nexport function find<T, S extends T>(this: Observable<T>,\n predicate: (value: T, index: number) => value is S,\n thisArg?: any): Observable<S>;\nexport function find<T>(this: Observable<T>,\n predicate: (value: T, index: number) => boolean,\n thisArg?: any): Observable<T>;\n/* tslint:enable:max-line-length */\n\n/**\n * Emits only the first value emitted by the source Observable that meets some\n * condition.\n *\n * <span class=\"informal\">Finds the first value that passes some test and emits\n * that.</span>\n *\n * <img src=\"./img/find.png\" width=\"100%\">\n *\n * `find` searches for the first item in the source Observable that matches the\n * specified condition embodied by the `predicate`, and returns the first\n * occurrence in the source. Unlike {@link first}, the `predicate` is required\n * in `find`, and does not emit an error if a valid value is not found.\n *\n * @example <caption>Find and emit the first click that happens on a DIV element</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.find(ev => ev.target.tagName === 'DIV');\n * result.subscribe(x => console.log(x));\n *\n * @see {@link filter}\n * @see {@link first}\n * @see {@link findIndex}\n * @see {@link take}\n *\n * @param {function(value: T, index: number, source: Observable<T>): boolean} predicate\n * A function called with each item to test for condition matching.\n * @param {any} [thisArg] An optional argument to determine the value of `this`\n * in the `predicate` function.\n * @return {Observable<T>} An Observable of the first item that matches the\n * condition.\n * @method find\n * @owner Observable\n */\nexport function find<T>(this: Observable<T>, predicate: (value: T, index: number, source: Observable<T>) => boolean,\n thisArg?: any): Observable<T> {\n return higherOrder(predicate, thisArg)(this);\n}\n"]}