UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,651 lines (1,650 loc) 125 kB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "ArrayObservable", "range": [ 9, 24 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 24 } } }, "imported": { "type": "Identifier", "name": "ArrayObservable", "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": "../observable/ArrayObservable", "raw": "'../observable/ArrayObservable'", "range": [ 32, 63 ], "loc": { "start": { "line": 1, "column": 32 }, "end": { "line": 1, "column": 63 } } }, "range": [ 0, 64 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 64 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "MergeAllOperator", "range": [ 74, 90 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 25 } } }, "imported": { "type": "Identifier", "name": "MergeAllOperator", "range": [ 74, 90 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 25 } } }, "range": [ 74, 90 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 25 } } } ], "source": { "type": "Literal", "value": "./mergeAll", "raw": "'./mergeAll'", "range": [ 98, 110 ], "loc": { "start": { "line": 2, "column": 33 }, "end": { "line": 2, "column": 45 } } }, "range": [ 65, 111 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 46 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "isScheduler", "range": [ 121, 132 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 20 } } }, "imported": { "type": "Identifier", "name": "isScheduler", "range": [ 121, 132 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 20 } } }, "range": [ 121, 132 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 20 } } } ], "source": { "type": "Literal", "value": "../util/isScheduler", "raw": "'../util/isScheduler'", "range": [ 140, 161 ], "loc": { "start": { "line": 3, "column": 28 }, "end": { "line": 3, "column": 49 } } }, "range": [ 112, 162 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 50 } }, "trailingComments": [ { "type": "Block", "value": " tslint:disable:max-line-length ", "range": [ 163, 199 ], "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 36 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "merge", "range": [ 216, 221 ], "loc": { "start": { "line": 5, "column": 16 }, "end": { "line": 5, "column": 21 } } }, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "observables", "range": [ 234, 245 ], "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 19 } } }, "init": { "type": "ArrayExpression", "elements": [], "range": [ 248, 250 ], "loc": { "start": { "line": 6, "column": 22 }, "end": { "line": 6, "column": 24 } } }, "range": [ 234, 250 ], "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 24 } } } ], "kind": "var", "range": [ 230, 251 ], "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 25 } } }, { "type": "ForStatement", "init": { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "_i", "range": [ 265, 267 ], "loc": { "start": { "line": 7, "column": 13 }, "end": { "line": 7, "column": 15 } } }, "init": { "type": "Literal", "value": 0, "raw": "0", "range": [ 270, 271 ], "loc": { "start": { "line": 7, "column": 18 }, "end": { "line": 7, "column": 19 } } }, "range": [ 265, 271 ], "loc": { "start": { "line": 7, "column": 13 }, "end": { "line": 7, "column": 19 } } } ], "kind": "var", "range": [ 261, 271 ], "loc": { "start": { "line": 7, "column": 9 }, "end": { "line": 7, "column": 19 } } }, "test": { "type": "BinaryExpression", "operator": "<", "left": { "type": "Identifier", "name": "_i", "range": [ 273, 275 ], "loc": { "start": { "line": 7, "column": 21 }, "end": { "line": 7, "column": 23 } } }, "right": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "arguments", "range": [ 278, 287 ], "loc": { "start": { "line": 7, "column": 26 }, "end": { "line": 7, "column": 35 } } }, "property": { "type": "Identifier", "name": "length", "range": [ 288, 294 ], "loc": { "start": { "line": 7, "column": 36 }, "end": { "line": 7, "column": 42 } } }, "range": [ 278, 294 ], "loc": { "start": { "line": 7, "column": 26 }, "end": { "line": 7, "column": 42 } } }, "range": [ 273, 294 ], "loc": { "start": { "line": 7, "column": 21 }, "end": { "line": 7, "column": 42 } } }, "update": { "type": "UpdateExpression", "operator": "++", "argument": { "type": "Identifier", "name": "_i", "range": [ 296, 298 ], "loc": { "start": { "line": 7, "column": 44 }, "end": { "line": 7, "column": 46 } } }, "prefix": false, "range": [ 296, 300 ], "loc": { "start": { "line": 7, "column": 44 }, "end": { "line": 7, "column": 48 } } }, "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": true, "object": { "type": "Identifier", "name": "observables", "range": [ 312, 323 ], "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 19 } } }, "property": { "type": "BinaryExpression", "operator": "-", "left": { "type": "Identifier", "name": "_i", "range": [ 324, 326 ], "loc": { "start": { "line": 8, "column": 20 }, "end": { "line": 8, "column": 22 } } }, "right": { "type": "Literal", "value": 0, "raw": "0", "range": [ 329, 330 ], "loc": { "start": { "line": 8, "column": 25 }, "end": { "line": 8, "column": 26 } } }, "range": [ 324, 330 ], "loc": { "start": { "line": 8, "column": 20 }, "end": { "line": 8, "column": 26 } } }, "range": [ 312, 331 ], "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 27 } } }, "right": { "type": "MemberExpression", "computed": true, "object": { "type": "Identifier", "name": "arguments", "range": [ 334, 343 ], "loc": { "start": { "line": 8, "column": 30 }, "end": { "line": 8, "column": 39 } } }, "property": { "type": "Identifier", "name": "_i", "range": [ 344, 346 ], "loc": { "start": { "line": 8, "column": 40 }, "end": { "line": 8, "column": 42 } } }, "range": [ 334, 347 ], "loc": { "start": { "line": 8, "column": 30 }, "end": { "line": 8, "column": 43 } } }, "range": [ 312, 347 ], "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 43 } } }, "range": [ 312, 348 ], "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 44 } } } ], "range": [ 302, 354 ], "loc": { "start": { "line": 7, "column": 50 }, "end": { "line": 9, "column": 5 } } }, "range": [ 256, 354 ], "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 9, "column": 5 } } }, { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 366, 370 ], "loc": { "start": { "line": 10, "column": 11 }, "end": { "line": 10, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 371, 375 ], "loc": { "start": { "line": 10, "column": 16 }, "end": { "line": 10, "column": 20 } } }, "range": [ 366, 375 ], "loc": { "start": { "line": 10, "column": 11 }, "end": { "line": 10, "column": 20 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 376, 380 ], "loc": { "start": { "line": 10, "column": 21 }, "end": { "line": 10, "column": 25 } } }, "range": [ 366, 380 ], "loc": { "start": { "line": 10, "column": 11 }, "end": { "line": 10, "column": 25 } } }, "arguments": [ { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "mergeStatic", "range": [ 381, 392 ], "loc": { "start": { "line": 10, "column": 26 }, "end": { "line": 10, "column": 37 } } }, "property": { "type": "Identifier", "name": "apply", "range": [ 393, 398 ], "loc": { "start": { "line": 10, "column": 38 }, "end": { "line": 10, "column": 43 } } }, "range": [ 381, 398 ], "loc": { "start": { "line": 10, "column": 26 }, "end": { "line": 10, "column": 43 } } }, "arguments": [ { "type": "UnaryExpression", "operator": "void", "argument": { "type": "Literal", "value": 0, "raw": "0", "range": [ 404, 405 ], "loc": { "start": { "line": 10, "column": 49 }, "end": { "line": 10, "column": 50 } } }, "prefix": true, "range": [ 399, 405 ], "loc": { "start": { "line": 10, "column": 44 }, "end": { "line": 10, "column": 50 } } }, { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ArrayExpression", "elements": [ { "type": "ThisExpression", "range": [ 408, 412 ], "loc": { "start": { "line": 10, "column": 53 }, "end": { "line": 10, "column": 57 } } } ], "range": [ 407, 413 ], "loc": { "start": { "line": 10, "column": 52 }, "end": { "line": 10, "column": 58 } } }, "property": { "type": "Identifier", "name": "concat", "range": [ 414, 420 ], "loc": { "start": { "line": 10, "column": 59 }, "end": { "line": 10, "column": 65 } } }, "range": [ 407, 420 ], "loc": { "start": { "line": 10, "column": 52 }, "end": { "line": 10, "column": 65 } } }, "arguments": [ { "type": "Identifier", "name": "observables", "range": [ 421, 432 ], "loc": { "start": { "line": 10, "column": 66 }, "end": { "line": 10, "column": 77 } } } ], "range": [ 407, 433 ], "loc": { "start": { "line": 10, "column": 52 }, "end": { "line": 10, "column": 78 } } } ], "range": [ 381, 434 ], "loc": { "start": { "line": 10, "column": 26 }, "end": { "line": 10, "column": 79 } } } ], "range": [ 366, 435 ], "loc": { "start": { "line": 10, "column": 11 }, "end": { "line": 10, "column": 80 } } }, "range": [ 359, 436 ], "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 81 } } } ], "range": [ 224, 438 ], "loc": { "start": { "line": 5, "column": 24 }, "end": { "line": 11, "column": 1 } } }, "generator": false, "expression": false, "range": [ 207, 438 ], "loc": { "start": { "line": 5, "column": 7 }, "end": { "line": 11, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": " tslint:disable:max-line-length ", "range": [ 163, 199 ], "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 36 } } } ], "trailingComments": [ { "type": "Block", "value": " tslint:enable:max-line-length ", "range": [ 439, 474 ], "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 35 } } }, { "type": "Block", "value": "*\n * Creates an output Observable which concurrently emits all values from every\n * given input Observable.\n *\n * <span class=\"informal\">Flattens multiple Observables together by blending\n * their values into one Observable.</span>\n *\n * <img src=\"./img/merge.png\" width=\"100%\">\n *\n * `merge` subscribes to each given input Observable (as arguments), and simply\n * forwards (without doing any transformation) all the values from all the input\n * Observables to the output Observable. The output Observable only completes\n * once all input Observables have completed. Any error delivered by an input\n * Observable will be immediately emitted on the output Observable.\n *\n * @example <caption>Merge together two Observables: 1s interval and clicks</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var timer = Rx.Observable.interval(1000);\n * var clicksOrTimer = Rx.Observable.merge(clicks, timer);\n * clicksOrTimer.subscribe(x => console.log(x));\n *\n * @example <caption>Merge together 3 Observables, but only 2 run concurrently</caption>\n * var timer1 = Rx.Observable.interval(1000).take(10);\n * var timer2 = Rx.Observable.interval(2000).take(6);\n * var timer3 = Rx.Observable.interval(500).take(10);\n * var concurrent = 2; // the argument\n * var merged = Rx.Observable.merge(timer1, timer2, timer3, concurrent);\n * merged.subscribe(x => console.log(x));\n *\n * @see {@link mergeAll}\n * @see {@link mergeMap}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n *\n * @param {...Observable} observables Input Observables to merge together.\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input\n * Observables being subscribed to concurrently.\n * @param {Scheduler} [scheduler=null] The Scheduler to use for managing\n * concurrency of input Observables.\n * @return {Observable} an Observable that emits items that are the result of\n * every input Observable.\n * @static true\n * @name merge\n * @owner Observable\n ", "range": [ 475, 2439 ], "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 57, "column": 3 } } } ] }, "specifiers": [], "source": null, "range": [ 200, 438 ], "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 11, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": " tslint:disable:max-line-length ", "range": [ 163, 199 ], "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 36 } } } ], "trailingComments": [ { "type": "Block", "value": " tslint:enable:max-line-length ", "range": [ 439, 474 ], "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 35 } } }, { "type": "Block", "value": "*\n * Creates an output Observable which concurrently emits all values from every\n * given input Observable.\n *\n * <span class=\"informal\">Flattens multiple Observables together by blending\n * their values into one Observable.</span>\n *\n * <img src=\"./img/merge.png\" width=\"100%\">\n *\n * `merge` subscribes to each given input Observable (as arguments), and simply\n * forwards (without doing any transformation) all the values from all the input\n * Observables to the output Observable. The output Observable only completes\n * once all input Observables have completed. Any error delivered by an input\n * Observable will be immediately emitted on the output Observable.\n *\n * @example <caption>Merge together two Observables: 1s interval and clicks</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var timer = Rx.Observable.interval(1000);\n * var clicksOrTimer = Rx.Observable.merge(clicks, timer);\n * clicksOrTimer.subscribe(x => console.log(x));\n *\n * @example <caption>Merge together 3 Observables, but only 2 run concurrently</caption>\n * var timer1 = Rx.Observable.interval(1000).take(10);\n * var timer2 = Rx.Observable.interval(2000).take(6);\n * var timer3 = Rx.Observable.interval(500).take(10);\n * var concurrent = 2; // the argument\n * var merged = Rx.Observable.merge(timer1, timer2, timer3, concurrent);\n * merged.subscribe(x => console.log(x));\n *\n * @see {@link mergeAll}\n * @see {@link mergeMap}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n *\n * @param {...Observable} observables Input Observables to merge together.\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input\n * Observables being subscribed to concurrently.\n * @param {Scheduler} [scheduler=null] The Scheduler to use for managing\n * concurrency of input Observables.\n * @return {Observable} an Observable that emits items that are the result of\n * every input Observable.\n * @static true\n * @name merge\n * @owner Observable\n ", "range": [ 475, 2439 ], "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 57, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "mergeStatic", "range": [ 2456, 2467 ], "loc": { "start": { "line": 58, "column": 16 }, "end": { "line": 58, "column": 27 } } }, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "observables", "range": [ 2480, 2491 ], "loc": { "start": { "line": 59, "column": 8 }, "end": { "line": 59, "column": 19 } } }, "init": { "type": "ArrayExpression", "elements": [], "range": [ 2494, 2496 ], "loc": { "start": { "line": 59, "column": 22 }, "end": { "line": 59, "column": 24 } } }, "range": [ 2480, 2496 ], "loc": { "start": { "line": 59, "column": 8 }, "end": { "line": 59, "column": 24 } } } ], "kind": "var", "range": [ 2476, 2497 ], "loc": { "start": { "line": 59, "column": 4 }, "end": { "line": 59, "column": 25 } } }, { "type": "ForStatement", "init": { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "_i", "range": [ 2511, 2513 ], "loc": { "start": { "line": 60, "column": 13 }, "end": { "line": 60, "column": 15 } } }, "init": { "type": "Literal", "value": 0, "raw": "0", "range": [ 2516, 2517 ], "loc": { "start": { "line": 60, "column": 18 }, "end": { "line": 60, "column": 19 } } }, "range": [ 2511, 2517 ], "loc": { "start": { "line": 60, "column": 13 }, "end": { "line": 60, "column": 19 } } } ], "kind": "var", "range": [ 2507, 2517 ], "loc": { "start": { "line": 60, "column": 9 }, "end": { "line": 60, "column": 19 } } }, "test": { "type": "BinaryExpression", "operator": "<", "left": { "type": "Identifier", "name": "_i", "range": [ 2519, 2521 ], "loc": { "start": { "line": 60, "column": 21 }, "end": { "line": 60, "column": 23 } } }, "right": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "arguments", "range": [ 2524, 2533 ], "loc": { "start": { "line": 60, "column": 26 }, "end": { "line": 60, "column": 35 } } }, "property": { "type": "Identifier", "name": "length", "range": [ 2534, 2540 ], "loc": { "start": { "line": 60, "column": 36 }, "end": { "line": 60, "column": 42 } } }, "range": [ 2524, 2540 ], "loc": { "start": { "line": 60, "column": 26 }, "end": { "line": 60, "column": 42 } } }, "range": [ 2519, 2540 ], "loc": { "start": { "line": 60, "column": 21 }, "end": { "line": 60, "column": 42 } } }, "update": { "type": "UpdateExpression", "operator": "++", "argument": { "type": "Identifier", "name": "_i", "range": [ 2542, 2544 ], "loc": { "start": { "line": 60, "column": 44 }, "end": { "line": 60, "column": 46 } } }, "prefix": false, "range": [ 2542, 2546 ], "loc": { "start": { "line": 60, "column": 44 }, "end": { "line": 60, "column": 48 } } }, "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": true, "object": { "type": "Identifier", "name": "observables", "range": [ 2558, 2569 ], "loc": { "start": { "line": 61, "column": 8 }, "end": { "line": 61,