UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

560 lines 18.8 kB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "FindValueOperator", "range": [ 9, 26 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 26 } } }, "imported": { "type": "Identifier", "name": "FindValueOperator", "range": [ 9, 26 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 26 } } }, "range": [ 9, 26 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 26 } } } ], "source": { "type": "Literal", "value": "./find", "raw": "'./find'", "range": [ 34, 42 ], "loc": { "start": { "line": 1, "column": 34 }, "end": { "line": 1, "column": 42 } } }, "range": [ 0, 43 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 43 } }, "trailingComments": [ { "type": "Block", "value": "*\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 ", "range": [ 44, 1443 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 35, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "findIndex", "range": [ 1460, 1469 ], "loc": { "start": { "line": 36, "column": 16 }, "end": { "line": 36, "column": 25 } } }, "params": [ { "type": "Identifier", "name": "predicate", "range": [ 1470, 1479 ], "loc": { "start": { "line": 36, "column": 26 }, "end": { "line": 36, "column": 35 } } }, { "type": "Identifier", "name": "thisArg", "range": [ 1481, 1488 ], "loc": { "start": { "line": 36, "column": 37 }, "end": { "line": 36, "column": 44 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1503, 1507 ], "loc": { "start": { "line": 37, "column": 11 }, "end": { "line": 37, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 1508, 1512 ], "loc": { "start": { "line": 37, "column": 16 }, "end": { "line": 37, "column": 20 } } }, "range": [ 1503, 1512 ], "loc": { "start": { "line": 37, "column": 11 }, "end": { "line": 37, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "FindValueOperator", "range": [ 1517, 1534 ], "loc": { "start": { "line": 37, "column": 25 }, "end": { "line": 37, "column": 42 } } }, "arguments": [ { "type": "Identifier", "name": "predicate", "range": [ 1535, 1544 ], "loc": { "start": { "line": 37, "column": 43 }, "end": { "line": 37, "column": 52 } } }, { "type": "ThisExpression", "range": [ 1546, 1550 ], "loc": { "start": { "line": 37, "column": 54 }, "end": { "line": 37, "column": 58 } } }, { "type": "Literal", "value": true, "raw": "true", "range": [ 1552, 1556 ], "loc": { "start": { "line": 37, "column": 60 }, "end": { "line": 37, "column": 64 } } }, { "type": "Identifier", "name": "thisArg", "range": [ 1558, 1565 ], "loc": { "start": { "line": 37, "column": 66 }, "end": { "line": 37, "column": 73 } } } ], "range": [ 1513, 1566 ], "loc": { "start": { "line": 37, "column": 21 }, "end": { "line": 37, "column": 74 } } } ], "range": [ 1503, 1567 ], "loc": { "start": { "line": 37, "column": 11 }, "end": { "line": 37, "column": 75 } } }, "range": [ 1496, 1568 ], "loc": { "start": { "line": 37, "column": 4 }, "end": { "line": 37, "column": 76 } } } ], "range": [ 1490, 1570 ], "loc": { "start": { "line": 36, "column": 46 }, "end": { "line": 38, "column": 1 } } }, "generator": false, "expression": false, "range": [ 1451, 1570 ], "loc": { "start": { "line": 36, "column": 7 }, "end": { "line": 38, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\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 ", "range": [ 44, 1443 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 35, "column": 3 } } } ], "trailingComments": [ { "type": "Line", "value": "# sourceMappingURL=findIndex.js.map", "range": [ 1571, 1608 ], "loc": { "start": { "line": 39, "column": 0 }, "end": { "line": 39, "column": 37 } } } ] }, "specifiers": [], "source": null, "range": [ 1444, 1570 ], "loc": { "start": { "line": 36, "column": 0 }, "end": { "line": 38, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\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 ", "range": [ 44, 1443 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 35, "column": 3 } } } ], "trailingComments": [ { "type": "Line", "value": "# sourceMappingURL=findIndex.js.map", "range": [ 1571, 1608 ], "loc": { "start": { "line": 39, "column": 0 }, "end": { "line": 39, "column": 37 } } } ] } ], "sourceType": "module", "range": [ 0, 1570 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 38, "column": 1 } }, "comments": [ { "type": "Block", "value": "*\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 ", "range": [ 44, 1443 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 35, "column": 3 } } }, { "type": "Line", "value": "# sourceMappingURL=findIndex.js.map", "range": [ 1571, 1608 ], "loc": { "start": { "line": 39, "column": 0 }, "end": { "line": 39, "column": 37 } } } ] }