UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

760 lines 27.4 kB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "not", "range": [ 9, 12 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 12 } } }, "imported": { "type": "Identifier", "name": "not", "range": [ 9, 12 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 12 } } }, "range": [ 9, 12 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 12 } } } ], "source": { "type": "Literal", "value": "../util/not", "raw": "'../util/not'", "range": [ 20, 33 ], "loc": { "start": { "line": 1, "column": 20 }, "end": { "line": 1, "column": 33 } } }, "range": [ 0, 34 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 34 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "filter", "range": [ 44, 50 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 15 } } }, "imported": { "type": "Identifier", "name": "filter", "range": [ 44, 50 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 15 } } }, "range": [ 44, 50 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 15 } } } ], "source": { "type": "Literal", "value": "./filter", "raw": "'./filter'", "range": [ 58, 68 ], "loc": { "start": { "line": 2, "column": 23 }, "end": { "line": 2, "column": 33 } } }, "range": [ 35, 69 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 34 } }, "trailingComments": [ { "type": "Block", "value": "*\n * Splits the source Observable into two, one with values that satisfy a\n * predicate, and another with values that don't satisfy the predicate.\n *\n * <span class=\"informal\">It's like {@link filter}, but returns two Observables:\n * one like the output of {@link filter}, and the other with values that did not\n * pass the condition.</span>\n *\n * <img src=\"./img/partition.png\" width=\"100%\">\n *\n * `partition` outputs an array with two Observables that partition the values\n * from the source Observable through the given `predicate` function. The first\n * Observable in that array emits source values for which the predicate argument\n * returns true. The second Observable emits source values for which the\n * predicate returns false. The first behaves like {@link filter} and the second\n * behaves like {@link filter} with the predicate negated.\n *\n * @example <caption>Partition click events into those on DIV elements and those elsewhere</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var parts = clicks.partition(ev => ev.target.tagName === 'DIV');\n * var clicksOnDivs = parts[0];\n * var clicksElsewhere = parts[1];\n * clicksOnDivs.subscribe(x => console.log('DIV clicked: ', x));\n * clicksElsewhere.subscribe(x => console.log('Other clicked: ', x));\n *\n * @see {@link filter}\n *\n * @param {function(value: T, index: number): boolean} predicate A function that\n * evaluates each value emitted by the source Observable. If it returns `true`,\n * the value is emitted on the first Observable in the returned array, if\n * `false` the value is emitted on the second Observable in the array. The\n * `index` parameter is the number `i` for the i-th source emission that has\n * happened since the subscription, starting from the number `0`.\n * @param {any} [thisArg] An optional argument to determine the value of `this`\n * in the `predicate` function.\n * @return {[Observable<T>, Observable<T>]} An array with two Observables: one\n * with values that passed the predicate, and another with values that did not\n * pass the predicate.\n * @method partition\n * @owner Observable\n ", "range": [ 70, 2175 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 43, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "partition", "range": [ 2192, 2201 ], "loc": { "start": { "line": 44, "column": 16 }, "end": { "line": 44, "column": 25 } } }, "params": [ { "type": "Identifier", "name": "predicate", "range": [ 2202, 2211 ], "loc": { "start": { "line": 44, "column": 26 }, "end": { "line": 44, "column": 35 } } }, { "type": "Identifier", "name": "thisArg", "range": [ 2213, 2220 ], "loc": { "start": { "line": 44, "column": 37 }, "end": { "line": 44, "column": 44 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "ArrayExpression", "elements": [ { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "filter", "range": [ 2245, 2251 ], "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 14 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 2252, 2256 ], "loc": { "start": { "line": 46, "column": 15 }, "end": { "line": 46, "column": 19 } } }, "range": [ 2245, 2256 ], "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 19 } } }, "arguments": [ { "type": "ThisExpression", "range": [ 2257, 2261 ], "loc": { "start": { "line": 46, "column": 20 }, "end": { "line": 46, "column": 24 } } }, { "type": "Identifier", "name": "predicate", "range": [ 2263, 2272 ], "loc": { "start": { "line": 46, "column": 26 }, "end": { "line": 46, "column": 35 } } } ], "range": [ 2245, 2273 ], "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 36 } } }, { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "filter", "range": [ 2283, 2289 ], "loc": { "start": { "line": 47, "column": 8 }, "end": { "line": 47, "column": 14 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 2290, 2294 ], "loc": { "start": { "line": 47, "column": 15 }, "end": { "line": 47, "column": 19 } } }, "range": [ 2283, 2294 ], "loc": { "start": { "line": 47, "column": 8 }, "end": { "line": 47, "column": 19 } } }, "arguments": [ { "type": "ThisExpression", "range": [ 2295, 2299 ], "loc": { "start": { "line": 47, "column": 20 }, "end": { "line": 47, "column": 24 } } }, { "type": "CallExpression", "callee": { "type": "Identifier", "name": "not", "range": [ 2301, 2304 ], "loc": { "start": { "line": 47, "column": 26 }, "end": { "line": 47, "column": 29 } } }, "arguments": [ { "type": "Identifier", "name": "predicate", "range": [ 2305, 2314 ], "loc": { "start": { "line": 47, "column": 30 }, "end": { "line": 47, "column": 39 } } }, { "type": "Identifier", "name": "thisArg", "range": [ 2316, 2323 ], "loc": { "start": { "line": 47, "column": 41 }, "end": { "line": 47, "column": 48 } } } ], "range": [ 2301, 2324 ], "loc": { "start": { "line": 47, "column": 26 }, "end": { "line": 47, "column": 49 } } } ], "range": [ 2283, 2325 ], "loc": { "start": { "line": 47, "column": 8 }, "end": { "line": 47, "column": 50 } } } ], "range": [ 2235, 2331 ], "loc": { "start": { "line": 45, "column": 11 }, "end": { "line": 48, "column": 5 } } }, "range": [ 2228, 2332 ], "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 48, "column": 6 } } } ], "range": [ 2222, 2334 ], "loc": { "start": { "line": 44, "column": 46 }, "end": { "line": 49, "column": 1 } } }, "generator": false, "expression": false, "range": [ 2183, 2334 ], "loc": { "start": { "line": 44, "column": 7 }, "end": { "line": 49, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Splits the source Observable into two, one with values that satisfy a\n * predicate, and another with values that don't satisfy the predicate.\n *\n * <span class=\"informal\">It's like {@link filter}, but returns two Observables:\n * one like the output of {@link filter}, and the other with values that did not\n * pass the condition.</span>\n *\n * <img src=\"./img/partition.png\" width=\"100%\">\n *\n * `partition` outputs an array with two Observables that partition the values\n * from the source Observable through the given `predicate` function. The first\n * Observable in that array emits source values for which the predicate argument\n * returns true. The second Observable emits source values for which the\n * predicate returns false. The first behaves like {@link filter} and the second\n * behaves like {@link filter} with the predicate negated.\n *\n * @example <caption>Partition click events into those on DIV elements and those elsewhere</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var parts = clicks.partition(ev => ev.target.tagName === 'DIV');\n * var clicksOnDivs = parts[0];\n * var clicksElsewhere = parts[1];\n * clicksOnDivs.subscribe(x => console.log('DIV clicked: ', x));\n * clicksElsewhere.subscribe(x => console.log('Other clicked: ', x));\n *\n * @see {@link filter}\n *\n * @param {function(value: T, index: number): boolean} predicate A function that\n * evaluates each value emitted by the source Observable. If it returns `true`,\n * the value is emitted on the first Observable in the returned array, if\n * `false` the value is emitted on the second Observable in the array. The\n * `index` parameter is the number `i` for the i-th source emission that has\n * happened since the subscription, starting from the number `0`.\n * @param {any} [thisArg] An optional argument to determine the value of `this`\n * in the `predicate` function.\n * @return {[Observable<T>, Observable<T>]} An array with two Observables: one\n * with values that passed the predicate, and another with values that did not\n * pass the predicate.\n * @method partition\n * @owner Observable\n ", "range": [ 70, 2175 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 43, "column": 3 } } } ], "trailingComments": [ { "type": "Line", "value": "# sourceMappingURL=partition.js.map", "range": [ 2335, 2372 ], "loc": { "start": { "line": 50, "column": 0 }, "end": { "line": 50, "column": 37 } } } ] }, "specifiers": [], "source": null, "range": [ 2176, 2334 ], "loc": { "start": { "line": 44, "column": 0 }, "end": { "line": 49, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Splits the source Observable into two, one with values that satisfy a\n * predicate, and another with values that don't satisfy the predicate.\n *\n * <span class=\"informal\">It's like {@link filter}, but returns two Observables:\n * one like the output of {@link filter}, and the other with values that did not\n * pass the condition.</span>\n *\n * <img src=\"./img/partition.png\" width=\"100%\">\n *\n * `partition` outputs an array with two Observables that partition the values\n * from the source Observable through the given `predicate` function. The first\n * Observable in that array emits source values for which the predicate argument\n * returns true. The second Observable emits source values for which the\n * predicate returns false. The first behaves like {@link filter} and the second\n * behaves like {@link filter} with the predicate negated.\n *\n * @example <caption>Partition click events into those on DIV elements and those elsewhere</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var parts = clicks.partition(ev => ev.target.tagName === 'DIV');\n * var clicksOnDivs = parts[0];\n * var clicksElsewhere = parts[1];\n * clicksOnDivs.subscribe(x => console.log('DIV clicked: ', x));\n * clicksElsewhere.subscribe(x => console.log('Other clicked: ', x));\n *\n * @see {@link filter}\n *\n * @param {function(value: T, index: number): boolean} predicate A function that\n * evaluates each value emitted by the source Observable. If it returns `true`,\n * the value is emitted on the first Observable in the returned array, if\n * `false` the value is emitted on the second Observable in the array. The\n * `index` parameter is the number `i` for the i-th source emission that has\n * happened since the subscription, starting from the number `0`.\n * @param {any} [thisArg] An optional argument to determine the value of `this`\n * in the `predicate` function.\n * @return {[Observable<T>, Observable<T>]} An array with two Observables: one\n * with values that passed the predicate, and another with values that did not\n * pass the predicate.\n * @method partition\n * @owner Observable\n ", "range": [ 70, 2175 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 43, "column": 3 } } } ], "trailingComments": [ { "type": "Line", "value": "# sourceMappingURL=partition.js.map", "range": [ 2335, 2372 ], "loc": { "start": { "line": 50, "column": 0 }, "end": { "line": 50, "column": 37 } } } ] } ], "sourceType": "module", "range": [ 0, 2334 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 49, "column": 1 } }, "comments": [ { "type": "Block", "value": "*\n * Splits the source Observable into two, one with values that satisfy a\n * predicate, and another with values that don't satisfy the predicate.\n *\n * <span class=\"informal\">It's like {@link filter}, but returns two Observables:\n * one like the output of {@link filter}, and the other with values that did not\n * pass the condition.</span>\n *\n * <img src=\"./img/partition.png\" width=\"100%\">\n *\n * `partition` outputs an array with two Observables that partition the values\n * from the source Observable through the given `predicate` function. The first\n * Observable in that array emits source values for which the predicate argument\n * returns true. The second Observable emits source values for which the\n * predicate returns false. The first behaves like {@link filter} and the second\n * behaves like {@link filter} with the predicate negated.\n *\n * @example <caption>Partition click events into those on DIV elements and those elsewhere</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var parts = clicks.partition(ev => ev.target.tagName === 'DIV');\n * var clicksOnDivs = parts[0];\n * var clicksElsewhere = parts[1];\n * clicksOnDivs.subscribe(x => console.log('DIV clicked: ', x));\n * clicksElsewhere.subscribe(x => console.log('Other clicked: ', x));\n *\n * @see {@link filter}\n *\n * @param {function(value: T, index: number): boolean} predicate A function that\n * evaluates each value emitted by the source Observable. If it returns `true`,\n * the value is emitted on the first Observable in the returned array, if\n * `false` the value is emitted on the second Observable in the array. The\n * `index` parameter is the number `i` for the i-th source emission that has\n * happened since the subscription, starting from the number `0`.\n * @param {any} [thisArg] An optional argument to determine the value of `this`\n * in the `predicate` function.\n * @return {[Observable<T>, Observable<T>]} An array with two Observables: one\n * with values that passed the predicate, and another with values that did not\n * pass the predicate.\n * @method partition\n * @owner Observable\n ", "range": [ 70, 2175 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 43, "column": 3 } } }, { "type": "Line", "value": "# sourceMappingURL=partition.js.map", "range": [ 2335, 2372 ], "loc": { "start": { "line": 50, "column": 0 }, "end": { "line": 50, "column": 37 } } } ] }