UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,568 lines (1,567 loc) 225 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": "scan", "range": [ 97, 101 ], "loc": { "start": { "line": 3, "column": 16 }, "end": { "line": 3, "column": 20 } } }, "params": [ { "type": "Identifier", "name": "accumulator", "range": [ 102, 113 ], "loc": { "start": { "line": 3, "column": 21 }, "end": { "line": 3, "column": 32 } } }, { "type": "Identifier", "name": "seed", "range": [ 115, 119 ], "loc": { "start": { "line": 3, "column": 34 }, "end": { "line": 3, "column": 38 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "hasSeed", "range": [ 131, 138 ], "loc": { "start": { "line": 4, "column": 8 }, "end": { "line": 4, "column": 15 } } }, "init": { "type": "Literal", "value": false, "raw": "false", "range": [ 141, 146 ], "loc": { "start": { "line": 4, "column": 18 }, "end": { "line": 4, "column": 23 } } }, "range": [ 131, 146 ], "loc": { "start": { "line": 4, "column": 8 }, "end": { "line": 4, "column": 23 } } } ], "kind": "var", "range": [ 127, 147 ], "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": [ 152, 216 ], "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 68 } } }, { "type": "Line", "value": " hasSeed! so don't use `seed !== undefined` checks!", "range": [ 221, 274 ], "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": [ 279, 349 ], "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": [ 354, 422 ], "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": [ 427, 506 ], "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": [ 515, 524 ], "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 17 } } }, "property": { "type": "Identifier", "name": "length", "range": [ 525, 531 ], "loc": { "start": { "line": 10, "column": 18 }, "end": { "line": 10, "column": 24 } } }, "range": [ 515, 531 ], "loc": { "start": { "line": 10, "column": 8 }, "end": { "line": 10, "column": 24 } } }, "right": { "type": "Literal", "value": 2, "raw": "2", "range": [ 535, 536 ], "loc": { "start": { "line": 10, "column": 28 }, "end": { "line": 10, "column": 29 } } }, "range": [ 515, 536 ], "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": [ 548, 555 ], "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 15 } } }, "right": { "type": "Literal", "value": true, "raw": "true", "range": [ 558, 562 ], "loc": { "start": { "line": 11, "column": 18 }, "end": { "line": 11, "column": 22 } } }, "range": [ 548, 562 ], "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 22 } } }, "range": [ 548, 563 ], "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 23 } } } ], "range": [ 538, 569 ], "loc": { "start": { "line": 10, "column": 31 }, "end": { "line": 12, "column": 5 } } }, "alternate": null, "range": [ 511, 569 ], "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": [ 152, 216 ], "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 68 } } }, { "type": "Line", "value": " hasSeed! so don't use `seed !== undefined` checks!", "range": [ 221, 274 ], "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": [ 279, 349 ], "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": [ 354, 422 ], "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": [ 427, 506 ], "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": [ 581, 585 ], "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 586, 590 ], "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 20 } } }, "range": [ 581, 590 ], "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "ScanOperator", "range": [ 595, 607 ], "loc": { "start": { "line": 13, "column": 25 }, "end": { "line": 13, "column": 37 } } }, "arguments": [ { "type": "Identifier", "name": "accumulator", "range": [ 608, 619 ], "loc": { "start": { "line": 13, "column": 38 }, "end": { "line": 13, "column": 49 } } }, { "type": "Identifier", "name": "seed", "range": [ 621, 625 ], "loc": { "start": { "line": 13, "column": 51 }, "end": { "line": 13, "column": 55 } } }, { "type": "Identifier", "name": "hasSeed", "range": [ 627, 634 ], "loc": { "start": { "line": 13, "column": 57 }, "end": { "line": 13, "column": 64 } } } ], "range": [ 591, 635 ], "loc": { "start": { "line": 13, "column": 21 }, "end": { "line": 13, "column": 65 } } } ], "range": [ 581, 636 ], "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 66 } } }, "range": [ 574, 637 ], "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 67 } } } ], "range": [ 121, 639 ], "loc": { "start": { "line": 3, "column": 40 }, "end": { "line": 14, "column": 1 } } }, "generator": false, "expression": false, "range": [ 88, 639 ], "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, 639 ], "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": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "ScanOperator", "range": [ 644, 656 ], "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 16 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "ScanOperator", "range": [ 687, 699 ], "loc": { "start": { "line": 16, "column": 13 }, "end": { "line": 16, "column": 25 } } }, "params": [ { "type": "Identifier", "name": "accumulator", "range": [ 700, 711 ], "loc": { "start": { "line": 16, "column": 26 }, "end": { "line": 16, "column": 37 } } }, { "type": "Identifier", "name": "seed", "range": [ 713, 717 ], "loc": { "start": { "line": 16, "column": 39 }, "end": { "line": 16, "column": 43 } } }, { "type": "Identifier", "name": "hasSeed", "range": [ 719, 726 ], "loc": { "start": { "line": 16, "column": 45 }, "end": { "line": 16, "column": 52 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "IfStatement", "test": { "type": "BinaryExpression", "operator": "===", "left": { "type": "Identifier", "name": "hasSeed", "range": [ 742, 749 ], "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 19 } } }, "right": { "type": "UnaryExpression", "operator": "void", "argument": { "type": "Literal", "value": 0, "raw": "0", "range": [ 759, 760 ], "loc": { "start": { "line": 17, "column": 29 }, "end": { "line": 17, "column": 30 } } }, "prefix": true, "range": [ 754, 760 ], "loc": { "start": { "line": 17, "column": 24 }, "end": { "line": 17, "column": 30 } } }, "range": [ 742, 760 ], "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": [ 764, 771 ], "loc": { "start": { "line": 17, "column": 34 }, "end": { "line": 17, "column": 41 } } }, "right": { "type": "Literal", "value": false, "raw": "false", "range": [ 774, 779 ], "loc": { "start": { "line": 17, "column": 44 }, "end": { "line": 17, "column": 49 } } }, "range": [ 764, 779 ], "loc": { "start": { "line": 17, "column": 34 }, "end": { "line": 17, "column": 49 } } }, "range": [ 764, 780 ], "loc": { "start": { "line": 17, "column": 34 }, "end": { "line": 17, "column": 50 } } } ], "range": [ 762, 782 ], "loc": { "start": { "line": 17, "column": 32 }, "end": { "line": 17, "column": 52 } } }, "alternate": null, "range": [ 738, 782 ], "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": [ 791, 795 ], "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } } }, "property": { "type": "Identifier", "name": "accumulator", "range": [ 796, 807 ], "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 24 } } }, "range": [ 791, 807 ], "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 24 } } }, "right": { "type": "Identifier", "name": "accumulator", "range": [ 810, 821 ], "loc": { "start": { "line": 18, "column": 27 }, "end": { "line": 18, "column": 38 } } }, "range": [ 791, 821 ], "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 38 } } }, "range": [ 791, 822 ], "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": [ 831, 835 ], "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 12 } } }, "property": { "type": "Identifier", "name": "seed", "range": [ 836, 840 ], "loc": { "start": { "line": 19, "column": 13 }, "end": { "line": 19, "column": 17 } } }, "range": [ 831, 840 ], "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 17 } } }, "right": { "type": "Identifier", "name": "seed", "range": [ 843, 847 ], "loc": { "start": { "line": 19, "column": 20 }, "end": { "line": 19, "column": 24 } } }, "range": [ 831, 847 ], "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 24 } } }, "range": [ 831, 848 ], "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": [ 857, 861 ], "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 12 } } }, "property": { "type": "Identifier", "name": "hasSeed", "range": [ 862, 869 ], "loc": { "start": { "line": 20, "column": 13 }, "end": { "line": 20, "column": 20 } } }, "range": [ 857, 869 ], "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 20 } } }, "right": { "type": "Identifier", "name": "hasSeed", "range": [ 872, 879 ], "loc": { "start": { "line": 20, "column": 23 }, "end": { "line": 20, "column": 30 } } }, "range": [ 857, 879 ], "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 30 } } }, "range": [ 857, 880 ], "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 31 } } } ], "range": [ 728, 886 ], "loc": { "start": { "line": 16, "column": 54 }, "end": { "line": 21, "column": 5 } } }, "generator": false, "expression": false, "range": [ 678, 886 ], "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 21, "column": 5 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "ScanOperator", "range": [ 891,