UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,428 lines (1,427 loc) 70.5 kB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "root", "range": [ 9, 13 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 13 } } }, "imported": { "type": "Identifier", "name": "root", "range": [ 9, 13 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 13 } } }, "range": [ 9, 13 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 13 } } } ], "source": { "type": "Literal", "value": "../util/root", "raw": "'../util/root'", "range": [ 21, 35 ], "loc": { "start": { "line": 1, "column": 21 }, "end": { "line": 1, "column": 35 } } }, "range": [ 0, 36 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 36 } }, "trailingComments": [ { "type": "Block", "value": " tslint:disable:max-line-length ", "range": [ 37, 73 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 36 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "toPromise", "range": [ 90, 99 ], "loc": { "start": { "line": 3, "column": 16 }, "end": { "line": 3, "column": 25 } } }, "params": [ { "type": "Identifier", "name": "PromiseCtor", "range": [ 100, 111 ], "loc": { "start": { "line": 3, "column": 26 }, "end": { "line": 3, "column": 37 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "_this", "range": [ 123, 128 ], "loc": { "start": { "line": 4, "column": 8 }, "end": { "line": 4, "column": 13 } } }, "init": { "type": "ThisExpression", "range": [ 131, 135 ], "loc": { "start": { "line": 4, "column": 16 }, "end": { "line": 4, "column": 20 } } }, "range": [ 123, 135 ], "loc": { "start": { "line": 4, "column": 8 }, "end": { "line": 4, "column": 20 } } } ], "kind": "var", "range": [ 119, 136 ], "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 21 } } }, { "type": "IfStatement", "test": { "type": "UnaryExpression", "operator": "!", "argument": { "type": "Identifier", "name": "PromiseCtor", "range": [ 146, 157 ], "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 20 } } }, "prefix": true, "range": [ 145, 157 ], "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 20 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "IfStatement", "test": { "type": "LogicalExpression", "operator": "&&", "left": { "type": "LogicalExpression", "operator": "&&", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "root", "range": [ 173, 177 ], "loc": { "start": { "line": 6, "column": 12 }, "end": { "line": 6, "column": 16 } } }, "property": { "type": "Identifier", "name": "Rx", "range": [ 178, 180 ], "loc": { "start": { "line": 6, "column": 17 }, "end": { "line": 6, "column": 19 } } }, "range": [ 173, 180 ], "loc": { "start": { "line": 6, "column": 12 }, "end": { "line": 6, "column": 19 } } }, "right": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "root", "range": [ 184, 188 ], "loc": { "start": { "line": 6, "column": 23 }, "end": { "line": 6, "column": 27 } } }, "property": { "type": "Identifier", "name": "Rx", "range": [ 189, 191 ], "loc": { "start": { "line": 6, "column": 28 }, "end": { "line": 6, "column": 30 } } }, "range": [ 184, 191 ], "loc": { "start": { "line": 6, "column": 23 }, "end": { "line": 6, "column": 30 } } }, "property": { "type": "Identifier", "name": "config", "range": [ 192, 198 ], "loc": { "start": { "line": 6, "column": 31 }, "end": { "line": 6, "column": 37 } } }, "range": [ 184, 198 ], "loc": { "start": { "line": 6, "column": 23 }, "end": { "line": 6, "column": 37 } } }, "range": [ 173, 198 ], "loc": { "start": { "line": 6, "column": 12 }, "end": { "line": 6, "column": 37 } } }, "right": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "root", "range": [ 202, 206 ], "loc": { "start": { "line": 6, "column": 41 }, "end": { "line": 6, "column": 45 } } }, "property": { "type": "Identifier", "name": "Rx", "range": [ 207, 209 ], "loc": { "start": { "line": 6, "column": 46 }, "end": { "line": 6, "column": 48 } } }, "range": [ 202, 209 ], "loc": { "start": { "line": 6, "column": 41 }, "end": { "line": 6, "column": 48 } } }, "property": { "type": "Identifier", "name": "config", "range": [ 210, 216 ], "loc": { "start": { "line": 6, "column": 49 }, "end": { "line": 6, "column": 55 } } }, "range": [ 202, 216 ], "loc": { "start": { "line": 6, "column": 41 }, "end": { "line": 6, "column": 55 } } }, "property": { "type": "Identifier", "name": "Promise", "range": [ 217, 224 ], "loc": { "start": { "line": 6, "column": 56 }, "end": { "line": 6, "column": 63 } } }, "range": [ 202, 224 ], "loc": { "start": { "line": 6, "column": 41 }, "end": { "line": 6, "column": 63 } } }, "range": [ 173, 224 ], "loc": { "start": { "line": 6, "column": 12 }, "end": { "line": 6, "column": 63 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "Identifier", "name": "PromiseCtor", "range": [ 240, 251 ], "loc": { "start": { "line": 7, "column": 12 }, "end": { "line": 7, "column": 23 } } }, "right": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "root", "range": [ 254, 258 ], "loc": { "start": { "line": 7, "column": 26 }, "end": { "line": 7, "column": 30 } } }, "property": { "type": "Identifier", "name": "Rx", "range": [ 259, 261 ], "loc": { "start": { "line": 7, "column": 31 }, "end": { "line": 7, "column": 33 } } }, "range": [ 254, 261 ], "loc": { "start": { "line": 7, "column": 26 }, "end": { "line": 7, "column": 33 } } }, "property": { "type": "Identifier", "name": "config", "range": [ 262, 268 ], "loc": { "start": { "line": 7, "column": 34 }, "end": { "line": 7, "column": 40 } } }, "range": [ 254, 268 ], "loc": { "start": { "line": 7, "column": 26 }, "end": { "line": 7, "column": 40 } } }, "property": { "type": "Identifier", "name": "Promise", "range": [ 269, 276 ], "loc": { "start": { "line": 7, "column": 41 }, "end": { "line": 7, "column": 48 } } }, "range": [ 254, 276 ], "loc": { "start": { "line": 7, "column": 26 }, "end": { "line": 7, "column": 48 } } }, "range": [ 240, 276 ], "loc": { "start": { "line": 7, "column": 12 }, "end": { "line": 7, "column": 48 } } }, "range": [ 240, 277 ], "loc": { "start": { "line": 7, "column": 12 }, "end": { "line": 7, "column": 49 } } } ], "range": [ 226, 287 ], "loc": { "start": { "line": 6, "column": 65 }, "end": { "line": 8, "column": 9 } } }, "alternate": { "type": "IfStatement", "test": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "root", "range": [ 305, 309 ], "loc": { "start": { "line": 9, "column": 17 }, "end": { "line": 9, "column": 21 } } }, "property": { "type": "Identifier", "name": "Promise", "range": [ 310, 317 ], "loc": { "start": { "line": 9, "column": 22 }, "end": { "line": 9, "column": 29 } } }, "range": [ 305, 317 ], "loc": { "start": { "line": 9, "column": 17 }, "end": { "line": 9, "column": 29 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "Identifier", "name": "PromiseCtor", "range": [ 333, 344 ], "loc": { "start": { "line": 10, "column": 12 }, "end": { "line": 10, "column": 23 } } }, "right": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "root", "range": [ 347, 351 ], "loc": { "start": { "line": 10, "column": 26 }, "end": { "line": 10, "column": 30 } } }, "property": { "type": "Identifier", "name": "Promise", "range": [ 352, 359 ], "loc": { "start": { "line": 10, "column": 31 }, "end": { "line": 10, "column": 38 } } }, "range": [ 347, 359 ], "loc": { "start": { "line": 10, "column": 26 }, "end": { "line": 10, "column": 38 } } }, "range": [ 333, 359 ], "loc": { "start": { "line": 10, "column": 12 }, "end": { "line": 10, "column": 38 } } }, "range": [ 333, 360 ], "loc": { "start": { "line": 10, "column": 12 }, "end": { "line": 10, "column": 39 } } } ], "range": [ 319, 370 ], "loc": { "start": { "line": 9, "column": 31 }, "end": { "line": 11, "column": 9 } } }, "alternate": null, "range": [ 301, 370 ], "loc": { "start": { "line": 9, "column": 13 }, "end": { "line": 11, "column": 9 } } }, "range": [ 169, 370 ], "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 11, "column": 9 } } } ], "range": [ 159, 376 ], "loc": { "start": { "line": 5, "column": 22 }, "end": { "line": 12, "column": 5 } } }, "alternate": null, "range": [ 141, 376 ], "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 12, "column": 5 } } }, { "type": "IfStatement", "test": { "type": "UnaryExpression", "operator": "!", "argument": { "type": "Identifier", "name": "PromiseCtor", "range": [ 386, 397 ], "loc": { "start": { "line": 13, "column": 9 }, "end": { "line": 13, "column": 20 } } }, "prefix": true, "range": [ 385, 397 ], "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 20 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "ThrowStatement", "argument": { "type": "NewExpression", "callee": { "type": "Identifier", "name": "Error", "range": [ 419, 424 ], "loc": { "start": { "line": 14, "column": 18 }, "end": { "line": 14, "column": 23 } } }, "arguments": [ { "type": "Literal", "value": "no Promise impl found", "raw": "'no Promise impl found'", "range": [ 425, 448 ], "loc": { "start": { "line": 14, "column": 24 }, "end": { "line": 14, "column": 47 } } } ], "range": [ 415, 449 ], "loc": { "start": { "line": 14, "column": 14 }, "end": { "line": 14, "column": 48 } } }, "range": [ 409, 450 ], "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 49 } } } ], "range": [ 399, 456 ], "loc": { "start": { "line": 13, "column": 22 }, "end": { "line": 15, "column": 5 } } }, "alternate": null, "range": [ 381, 456 ], "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 15, "column": 5 } } }, { "type": "ReturnStatement", "argument": { "type": "NewExpression", "callee": { "type": "Identifier", "name": "PromiseCtor", "range": [ 472, 483 ], "loc": { "start": { "line": 16, "column": 15 }, "end": { "line": 16, "column": 26 } } }, "arguments": [ { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "resolve", "range": [ 494, 501 ], "loc": { "start": { "line": 16, "column": 37 }, "end": { "line": 16, "column": 44 } } }, { "type": "Identifier", "name": "reject", "range": [ 503, 509 ], "loc": { "start": { "line": 16, "column": 46 }, "end": { "line": 16, "column": 52 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "value", "range": [ 525, 530 ], "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 17 } } }, "init": null, "range": [ 525, 530 ], "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 17 } } } ], "kind": "var", "range": [ 521, 531 ], "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 18 } } }, { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "_this", "range": [ 540, 545 ], "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 13 } } }, "property": { "type": "Identifier", "name": "subscribe", "range": [ 546, 555 ], "loc": { "start": { "line": 18, "column": 14 }, "end": { "line": 18, "column": 23 } } }, "range": [ 540, 555 ], "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 23 } } }, "arguments": [ { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "x", "range": [ 566, 567 ], "loc": { "start": { "line": 18, "column": 34 }, "end": { "line": 18, "column": 35 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "Identifier", "name": "value", "range": [ 578, 583 ], "loc": { "start": { "line": 18, "column": 46 }, "end": { "line": 18, "column": 51 } } }, "right": { "type": "Identifier", "name": "x", "range": [ 586, 587 ], "loc": { "start": { "line": 18, "column": 54 }, "end": { "line": 18, "column": 55 } } }, "range": [ 578, 587 ], "loc": { "start": { "line": 18,