UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,533 lines (1,532 loc) 222 kB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "Subscriber", "range": [ 9, 19 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 19 } } }, "imported": { "type": "Identifier", "name": "Subscriber", "range": [ 9, 19 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 19 } } }, "range": [ 9, 19 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 19 } } } ], "source": { "type": "Literal", "value": "../Subscriber", "raw": "'../Subscriber'", "range": [ 27, 42 ], "loc": { "start": { "line": 1, "column": 27 }, "end": { "line": 1, "column": 42 } } }, "range": [ 0, 43 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 43 } }, "trailingComments": [ { "type": "Block", "value": " tslint:disable:max-line-length ", "range": [ 44, 80 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 36 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "reduce", "range": [ 97, 103 ], "loc": { "start": { "line": 3, "column": 16 }, "end": { "line": 3, "column": 22 } } }, "params": [ { "type": "Identifier", "name": "accumulator", "range": [ 104, 115 ], "loc": { "start": { "line": 3, "column": 23 }, "end": { "line": 3, "column": 34 } } }, { "type": "Identifier", "name": "seed", "range": [ 117, 121 ], "loc": { "start": { "line": 3, "column": 36 }, "end": { "line": 3, "column": 40 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "hasSeed", "range": [ 133, 140 ], "loc": { "start": { "line": 4, "column": 8 }, "end": { "line": 4, "column": 15 } } }, "init": { "type": "Literal", "value": false, "raw": "false", "range": [ 143, 148 ], "loc": { "start": { "line": 4, "column": 18 }, "end": { "line": 4, "column": 23 } } }, "range": [ 133, 148 ], "loc": { "start": { "line": 4, "column": 8 }, "end": { "line": 4, "column": 23 } } } ], "kind": "var", "range": [ 129, 149 ], "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 24 } }, "trailingComments": [ { "type": "Line", "value": " providing a seed of `undefined` *should* be valid and trigger", "range": [ 154, 218 ], "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 68 } } }, { "type": "Line", "value": " hasSeed! so don't use `seed !== undefined` checks!", "range": [ 223, 276 ], "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 57 } } }, { "type": "Line", "value": " For this reason, we have to check it here at the original call site", "range": [ 281, 351 ], "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 74 } } }, { "type": "Line", "value": " otherwise inside Operator/Subscriber we won't know if `undefined`", "range": [ 356, 424 ], "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 72 } } }, { "type": "Line", "value": " means they didn't provide anything or if they literally provided `undefined`", "range": [ 429, 508 ], "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 83 } } } ] }, { "type": "IfStatement", "test": { "type": "BinaryExpression", "operator": ">=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "arguments", "range": [ 517, 526 ], "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 17 } } }, "property": { "type": "Identifier", "name": "length", "range": [ 527, 533 ], "loc": { "start": { "line": 10, "column": 18 }, "end": { "line": 10, "column": 24 } } }, "range": [ 517, 533 ], "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 24 } } }, "right": { "type": "Literal", "value": 2, "raw": "2", "range": [ 537, 538 ], "loc": { "start": { "line": 10, "column": 28 }, "end": { "line": 10, "column": 29 } } }, "range": [ 517, 538 ], "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 29 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "Identifier", "name": "hasSeed", "range": [ 550, 557 ], "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 15 } } }, "right": { "type": "Literal", "value": true, "raw": "true", "range": [ 560, 564 ], "loc": { "start": { "line": 11, "column": 18 }, "end": { "line": 11, "column": 22 } } }, "range": [ 550, 564 ], "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 22 } } }, "range": [ 550, 565 ], "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 23 } } } ], "range": [ 540, 571 ], "loc": { "start": { "line": 10, "column": 31 }, "end": { "line": 12, "column": 5 } } }, "alternate": null, "range": [ 513, 571 ], "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 12, "column": 5 } }, "leadingComments": [ { "type": "Line", "value": " providing a seed of `undefined` *should* be valid and trigger", "range": [ 154, 218 ], "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 68 } } }, { "type": "Line", "value": " hasSeed! so don't use `seed !== undefined` checks!", "range": [ 223, 276 ], "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 57 } } }, { "type": "Line", "value": " For this reason, we have to check it here at the original call site", "range": [ 281, 351 ], "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 74 } } }, { "type": "Line", "value": " otherwise inside Operator/Subscriber we won't know if `undefined`", "range": [ 356, 424 ], "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 72 } } }, { "type": "Line", "value": " means they didn't provide anything or if they literally provided `undefined`", "range": [ 429, 508 ], "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 83 } } } ] }, { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 583, 587 ], "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 588, 592 ], "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 20 } } }, "range": [ 583, 592 ], "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "ReduceOperator", "range": [ 597, 611 ], "loc": { "start": { "line": 13, "column": 25 }, "end": { "line": 13, "column": 39 } } }, "arguments": [ { "type": "Identifier", "name": "accumulator", "range": [ 612, 623 ], "loc": { "start": { "line": 13, "column": 40 }, "end": { "line": 13, "column": 51 } } }, { "type": "Identifier", "name": "seed", "range": [ 625, 629 ], "loc": { "start": { "line": 13, "column": 53 }, "end": { "line": 13, "column": 57 } } }, { "type": "Identifier", "name": "hasSeed", "range": [ 631, 638 ], "loc": { "start": { "line": 13, "column": 59 }, "end": { "line": 13, "column": 66 } } } ], "range": [ 593, 639 ], "loc": { "start": { "line": 13, "column": 21 }, "end": { "line": 13, "column": 67 } } } ], "range": [ 583, 640 ], "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 68 } } }, "range": [ 576, 641 ], "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 69 } } } ], "range": [ 123, 643 ], "loc": { "start": { "line": 3, "column": 42 }, "end": { "line": 14, "column": 1 } } }, "generator": false, "expression": false, "range": [ 88, 643 ], "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 14, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": " tslint:disable:max-line-length ", "range": [ 44, 80 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 36 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 81, 643 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 14, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": " tslint:disable:max-line-length ", "range": [ 44, 80 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 36 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "ReduceOperator", "range": [ 655, 669 ], "loc": { "start": { "line": 15, "column": 11 }, "end": { "line": 15, "column": 25 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "ReduceOperator", "range": [ 700, 714 ], "loc": { "start": { "line": 16, "column": 13 }, "end": { "line": 16, "column": 27 } } }, "params": [ { "type": "Identifier", "name": "accumulator", "range": [ 715, 726 ], "loc": { "start": { "line": 16, "column": 28 }, "end": { "line": 16, "column": 39 } } }, { "type": "Identifier", "name": "seed", "range": [ 728, 732 ], "loc": { "start": { "line": 16, "column": 41 }, "end": { "line": 16, "column": 45 } } }, { "type": "Identifier", "name": "hasSeed", "range": [ 734, 741 ], "loc": { "start": { "line": 16, "column": 47 }, "end": { "line": 16, "column": 54 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "IfStatement", "test": { "type": "BinaryExpression", "operator": "===", "left": { "type": "Identifier", "name": "hasSeed", "range": [ 757, 764 ], "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 19 } } }, "right": { "type": "UnaryExpression", "operator": "void", "argument": { "type": "Literal", "value": 0, "raw": "0", "range": [ 774, 775 ], "loc": { "start": { "line": 17, "column": 29 }, "end": { "line": 17, "column": 30 } } }, "prefix": true, "range": [ 769, 775 ], "loc": { "start": { "line": 17, "column": 24 }, "end": { "line": 17, "column": 30 } } }, "range": [ 757, 775 ], "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 30 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "Identifier", "name": "hasSeed", "range": [ 779, 786 ], "loc": { "start": { "line": 17, "column": 34 }, "end": { "line": 17, "column": 41 } } }, "right": { "type": "Literal", "value": false, "raw": "false", "range": [ 789, 794 ], "loc": { "start": { "line": 17, "column": 44 }, "end": { "line": 17, "column": 49 } } }, "range": [ 779, 794 ], "loc": { "start": { "line": 17, "column": 34 }, "end": { "line": 17, "column": 49 } } }, "range": [ 779, 795 ], "loc": { "start": { "line": 17, "column": 34 }, "end": { "line": 17, "column": 50 } } } ], "range": [ 777, 797 ], "loc": { "start": { "line": 17, "column": 32 }, "end": { "line": 17, "column": 52 } } }, "alternate": null, "range": [ 753, 797 ], "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 52 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 806, 810 ], "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } } }, "property": { "type": "Identifier", "name": "accumulator", "range": [ 811, 822 ], "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 24 } } }, "range": [ 806, 822 ], "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 24 } } }, "right": { "type": "Identifier", "name": "accumulator", "range": [ 825, 836 ], "loc": { "start": { "line": 18, "column": 27 }, "end": { "line": 18, "column": 38 } } }, "range": [ 806, 836 ], "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 38 } } }, "range": [ 806, 837 ], "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 39 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 846, 850 ], "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 12 } } }, "property": { "type": "Identifier", "name": "seed", "range": [ 851, 855 ], "loc": { "start": { "line": 19, "column": 13 }, "end": { "line": 19, "column": 17 } } }, "range": [ 846, 855 ], "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 17 } } }, "right": { "type": "Identifier", "name": "seed", "range": [ 858, 862 ], "loc": { "start": { "line": 19, "column": 20 }, "end": { "line": 19, "column": 24 } } }, "range": [ 846, 862 ], "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 24 } } }, "range": [ 846, 863 ], "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 25 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 872, 876 ], "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 12 } } }, "property": { "type": "Identifier", "name": "hasSeed", "range": [ 877, 884 ], "loc": { "start": { "line": 20, "column": 13 }, "end": { "line": 20, "column": 20 } } }, "range": [ 872, 884 ], "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 20 } } }, "right": { "type": "Identifier", "name": "hasSeed", "range": [ 887, 894 ], "loc": { "start": { "line": 20, "column": 23 }, "end": { "line": 20, "column": 30 } } }, "range": [ 872, 894 ], "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 30 } } }, "range": [ 872, 895 ], "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 31 } } } ], "range": [ 743, 901 ], "loc": { "start": { "line": 16, "column": 56 }, "end": { "line": 21,