UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,403 lines (1,402 loc) 220 kB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "OuterSubscriber", "range": [ 9, 24 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 24 } } }, "imported": { "type": "Identifier", "name": "OuterSubscriber", "range": [ 9, 24 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 24 } } }, "range": [ 9, 24 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 24 } } } ], "source": { "type": "Literal", "value": "../OuterSubscriber", "raw": "'../OuterSubscriber'", "range": [ 32, 52 ], "loc": { "start": { "line": 1, "column": 32 }, "end": { "line": 1, "column": 52 } } }, "range": [ 0, 53 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 53 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "subscribeToResult", "range": [ 63, 80 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 26 } } }, "imported": { "type": "Identifier", "name": "subscribeToResult", "range": [ 63, 80 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 26 } } }, "range": [ 63, 80 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 26 } } } ], "source": { "type": "Literal", "value": "../util/subscribeToResult", "raw": "'../util/subscribeToResult'", "range": [ 88, 115 ], "loc": { "start": { "line": 2, "column": 34 }, "end": { "line": 2, "column": 61 } } }, "range": [ 54, 116 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 62 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "Set", "range": [ 126, 129 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 12 } } }, "imported": { "type": "Identifier", "name": "Set", "range": [ 126, 129 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 12 } } }, "range": [ 126, 129 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 12 } } } ], "source": { "type": "Literal", "value": "../util/Set", "raw": "'../util/Set'", "range": [ 137, 150 ], "loc": { "start": { "line": 3, "column": 20 }, "end": { "line": 3, "column": 33 } } }, "range": [ 117, 151 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 34 } }, "trailingComments": [ { "type": "Block", "value": "*\n * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.\n * If a keySelector function is provided, then it will project each value from the source observable into a new value that it will\n * check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the\n * source observable directly with an equality check against previous values.\n * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking.\n * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the\n * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct`\n * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so\n * that the internal `Set` can be \"flushed\", basically clearing it of values.\n * @param {function} [keySelector] optional function to select which value you want to check as distinct.\n * @param {Observable} [flushes] optional Observable for flushing the internal HashSet of the operator.\n * @return {Observable} an Observable that emits items from the source Observable with distinct values.\n * @method distinct\n * @owner Observable\n ", "range": [ 152, 1587 ], "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 19, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "distinct", "range": [ 1604, 1612 ], "loc": { "start": { "line": 20, "column": 16 }, "end": { "line": 20, "column": 24 } } }, "params": [ { "type": "Identifier", "name": "keySelector", "range": [ 1613, 1624 ], "loc": { "start": { "line": 20, "column": 25 }, "end": { "line": 20, "column": 36 } } }, { "type": "Identifier", "name": "flushes", "range": [ 1626, 1633 ], "loc": { "start": { "line": 20, "column": 38 }, "end": { "line": 20, "column": 45 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1648, 1652 ], "loc": { "start": { "line": 21, "column": 11 }, "end": { "line": 21, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 1653, 1657 ], "loc": { "start": { "line": 21, "column": 16 }, "end": { "line": 21, "column": 20 } } }, "range": [ 1648, 1657 ], "loc": { "start": { "line": 21, "column": 11 }, "end": { "line": 21, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "DistinctOperator", "range": [ 1662, 1678 ], "loc": { "start": { "line": 21, "column": 25 }, "end": { "line": 21, "column": 41 } } }, "arguments": [ { "type": "Identifier", "name": "keySelector", "range": [ 1679, 1690 ], "loc": { "start": { "line": 21, "column": 42 }, "end": { "line": 21, "column": 53 } } }, { "type": "Identifier", "name": "flushes", "range": [ 1692, 1699 ], "loc": { "start": { "line": 21, "column": 55 }, "end": { "line": 21, "column": 62 } } } ], "range": [ 1658, 1700 ], "loc": { "start": { "line": 21, "column": 21 }, "end": { "line": 21, "column": 63 } } } ], "range": [ 1648, 1701 ], "loc": { "start": { "line": 21, "column": 11 }, "end": { "line": 21, "column": 64 } } }, "range": [ 1641, 1702 ], "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 21, "column": 65 } } } ], "range": [ 1635, 1704 ], "loc": { "start": { "line": 20, "column": 47 }, "end": { "line": 22, "column": 1 } } }, "generator": false, "expression": false, "range": [ 1595, 1704 ], "loc": { "start": { "line": 20, "column": 7 }, "end": { "line": 22, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.\n * If a keySelector function is provided, then it will project each value from the source observable into a new value that it will\n * check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the\n * source observable directly with an equality check against previous values.\n * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking.\n * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the\n * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct`\n * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so\n * that the internal `Set` can be \"flushed\", basically clearing it of values.\n * @param {function} [keySelector] optional function to select which value you want to check as distinct.\n * @param {Observable} [flushes] optional Observable for flushing the internal HashSet of the operator.\n * @return {Observable} an Observable that emits items from the source Observable with distinct values.\n * @method distinct\n * @owner Observable\n ", "range": [ 152, 1587 ], "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 19, "column": 3 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 1588, 1704 ], "loc": { "start": { "line": 20, "column": 0 }, "end": { "line": 22, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.\n * If a keySelector function is provided, then it will project each value from the source observable into a new value that it will\n * check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the\n * source observable directly with an equality check against previous values.\n * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking.\n * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the\n * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct`\n * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so\n * that the internal `Set` can be \"flushed\", basically clearing it of values.\n * @param {function} [keySelector] optional function to select which value you want to check as distinct.\n * @param {Observable} [flushes] optional Observable for flushing the internal HashSet of the operator.\n * @return {Observable} an Observable that emits items from the source Observable with distinct values.\n * @method distinct\n * @owner Observable\n ", "range": [ 152, 1587 ], "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 19, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "DistinctOperator", "range": [ 1709, 1725 ], "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 20 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "DistinctOperator", "range": [ 1756, 1772 ], "loc": { "start": { "line": 24, "column": 13 }, "end": { "line": 24, "column": 29 } } }, "params": [ { "type": "Identifier", "name": "keySelector", "range": [ 1773, 1784 ], "loc": { "start": { "line": 24, "column": 30 }, "end": { "line": 24, "column": 41 } } }, { "type": "Identifier", "name": "flushes", "range": [ 1786, 1793 ], "loc": { "start": { "line": 24, "column": 43 }, "end": { "line": 24, "column": 50 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1805, 1809 ], "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 12 } } }, "property": { "type": "Identifier", "name": "keySelector", "range": [ 1810, 1821 ], "loc": { "start": { "line": 25, "column": 13 }, "end": { "line": 25, "column": 24 } } }, "range": [ 1805, 1821 ], "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 24 } } }, "right": { "type": "Identifier", "name": "keySelector", "range": [ 1824, 1835 ], "loc": { "start": { "line": 25, "column": 27 }, "end": { "line": 25, "column": 38 } } }, "range": [ 1805, 1835 ], "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 38 } } }, "range": [ 1805, 1836 ], "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 39 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1845, 1849 ], "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 12 } } }, "property": { "type": "Identifier", "name": "flushes", "range": [ 1850, 1857 ], "loc": { "start": { "line": 26, "column": 13 }, "end": { "line": 26, "column": 20 } } }, "range": [ 1845, 1857 ], "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 20 } } }, "right": { "type": "Identifier", "name": "flushes", "range": [ 1860, 1867 ], "loc": { "start": { "line": 26, "column": 23 }, "end": { "line": 26, "column": 30 } } }, "range": [ 1845, 1867 ], "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 30 } } }, "range": [ 1845, 1868 ], "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 31 } } } ], "range": [ 1795, 1874 ], "loc": { "start": { "line": 24, "column": 52 }, "end": { "line": 27, "column": 5 } } }, "generator": false, "expression": false, "range": [ 1747, 1874 ], "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 27, "column": 5 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "DistinctOperator", "range": [ 1879, 1895 ], "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 20 } } }, "property": { "type": "Identifier", "name": "prototype", "range": [ 1896, 1905 ], "loc": { "start": { "line": 28, "column": 21 }, "end": { "line": 28, "column": 30 } } }, "range": [ 1879, 1905 ], "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 30 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 1906, 1910 ], "loc": { "start": { "line": 28, "column": 31 }, "end": { "line": 28, "column": 35 } } }, "range": [ 1879, 1910 ], "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 35 } } }, "right": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "subscriber", "range": [ 1923, 1933 ], "loc": { "start": { "line": 28, "column": 48 }, "end": { "line": 28, "column": 58 } } }, { "type": "Identifier", "name": "source", "range": [ 1935, 1941 ], "loc": { "start": { "line": 28, "column": 60 }, "end": { "line": 28, "column": 66 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "source", "range": [ 1960, 1966 ], "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 21 } } }, "property": { "type": "Identifier", "name": "_subscribe", "range": [ 1967, 1977 ], "loc": { "start": { "line": 29, "column": 22 }, "end": { "line": 29, "column": 32 } } }, "range": [ 1960, 1977 ], "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 32 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "DistinctSubscriber", "range": [ 1982, 2000 ], "loc": { "start": { "line": 29, "column": 37 }, "end": { "line": 29, "column": 55 } } }, "arguments": [ { "type": "Identifier", "name": "subscriber", "range": [ 2001, 2011 ], "loc": { "start": { "line": 29, "column": 56 }, "end": { "line": 29, "column": 66 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2013, 2017 ], "loc": { "start": { "line": 29, "column": 68 }, "end": { "line": 29, "column": 72 } } }, "property": { "type": "Identifier", "name": "keySelector", "range": [ 2018, 2029 ], "loc": { "start": { "line": 29, "column": 73 }, "end": { "line": 29, "column": 84 } } }, "range": [ 2013, 2029 ], "loc": { "start": { "line": 29, "column": 68 }, "end": { "line": 29, "column": 84 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2031, 2035 ], "loc": { "start": { "line": 29, "column": 86 }, "end": { "line": 29, "column": 90 } } }, "property": { "type": "Identifier", "name": "flushes", "range": [ 2036, 2043 ], "loc": { "start": { "line": 29, "column": 91 }, "end": { "line": 29, "column": 98 } } }, "range": [ 2031, 2043 ], "loc": { "start": { "line": 29, "column": 86 }, "end": { "line": 29, "column": 98 } } } ], "range": [ 1978, 2044 ], "loc": { "start": { "line": 29, "column": 33 }, "end": { "line": 29, "column": 99 } } } ], "range": [ 1960, 2045 ], "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 100 } } }, "range": [ 1953, 2046 ], "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 101 } } } ], "range": [ 1943, 2052 ], "loc": { "start": { "line": 28, "column": 68 }, "end": { "line": 30, "column": 5 } } }, "generator": false, "expression": false, "range": [ 1913, 2052 ], "loc": { "start": { "line": 28, "column": 38 }, "end": { "line": 30, "column": 5 } } }, "range": [ 1879, 2052 ], "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 30, "column": 5 } } }, "range": [ 1879, 2053 ], "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 30, "column": 6 } }