Subtheme of barrio
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
2.1 KiB

2 years ago
{"version":3,"file":"findIndex.js","sourceRoot":"","sources":["../../src/operator/findIndex.ts"],"names":[],"mappings":";AACA,0BAAyC,wBAAwB,CAAC,CAAA;AAClE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,mBAAkD,SAAsE,EAC3F,OAAa;IACxC,MAAM,CAAC,qBAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC;AAHe,iBAAS,YAGxB,CAAA","sourcesContent":["import { Observable } from '../Observable';\nimport { findIndex as higherOrder } from '../operators/findIndex';\n/**\n * Emits only the index of the first value emitted by the source Observable that\n * meets some condition.\n *\n * <span class=\"informal\">It's like {@link find}, but emits the index of the\n * found value, not the value itself.</span>\n *\n * <img src=\"./img/findIndex.png\" width=\"100%\">\n *\n * `findIndex` searches for the first item in the source Observable that matches\n * the specified condition embodied by the `predicate`, and returns the\n * (zero-based) index of the first occurrence in the source. Unlike\n * {@link first}, the `predicate` is required in `findIndex`, and does not emit\n * an error if a valid value is not found.\n *\n * @example <caption>Emit the index of first click that happens on a DIV element</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.findIndex(ev => ev.target.tagName === 'DIV');\n * result.subscribe(x => console.log(x));\n *\n * @see {@link filter}\n * @see {@link find}\n * @see {@link first}\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} An Observable of the index of the first item that\n * matches the condition.\n * @method find\n * @owner Observable\n */\nexport function findIndex<T>(this: Observable<T>, predicate: (value: T, index: number, source: Observable<T>) => boolean,\n thisArg?: any): Observable<number> {\n return higherOrder(predicate, thisArg)(this);\n}\n"]}