@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,426 lines (1,425 loc) • 130 kB
JSON
{
"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
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "ArgumentOutOfRangeError",
"range": [
53,
76
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 32
}
}
},
"imported": {
"type": "Identifier",
"name": "ArgumentOutOfRangeError",
"range": [
53,
76
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 32
}
}
},
"range": [
53,
76
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 32
}
}
}
],
"source": {
"type": "Literal",
"value": "../util/ArgumentOutOfRangeError",
"raw": "'../util/ArgumentOutOfRangeError'",
"range": [
84,
117
],
"loc": {
"start": {
"line": 2,
"column": 40
},
"end": {
"line": 2,
"column": 73
}
}
},
"range": [
44,
118
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 74
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "EmptyObservable",
"range": [
128,
143
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 24
}
}
},
"imported": {
"type": "Identifier",
"name": "EmptyObservable",
"range": [
128,
143
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 24
}
}
},
"range": [
128,
143
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 24
}
}
}
],
"source": {
"type": "Literal",
"value": "../observable/EmptyObservable",
"raw": "'../observable/EmptyObservable'",
"range": [
151,
182
],
"loc": {
"start": {
"line": 3,
"column": 32
},
"end": {
"line": 3,
"column": 63
}
}
},
"range": [
119,
183
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 64
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * Emits only the first `count` values emitted by the source Observable.\n *\n * <span class=\"informal\">Takes the first `count` values from the source, then\n * completes.</span>\n *\n * <img src=\"./img/take.png\" width=\"100%\">\n *\n * `take` returns an Observable that emits only the first `count` values emitted\n * by the source Observable. If the source emits fewer than `count` values then\n * all of its values are emitted. After that, it completes, regardless if the\n * source completes.\n *\n * @example <caption>Take the first 5 seconds of an infinite 1-second interval Observable</caption>\n * var interval = Rx.Observable.interval(1000);\n * var five = interval.take(5);\n * five.subscribe(x => console.log(x));\n *\n * @see {@link takeLast}\n * @see {@link takeUntil}\n * @see {@link takeWhile}\n * @see {@link skip}\n *\n * @throws {ArgumentOutOfRangeError} When using `take(i)`, it delivers an\n * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`.\n *\n * @param {number} count The maximum number of `next` values to emit.\n * @return {Observable<T>} An Observable that emits only the first `count`\n * values emitted by the source Observable, or all of the values from the source\n * if the source emits fewer than `count` values.\n * @method take\n * @owner Observable\n ",
"range": [
184,
1467
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 36,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "take",
"range": [
1484,
1488
],
"loc": {
"start": {
"line": 37,
"column": 16
},
"end": {
"line": 37,
"column": 20
}
}
},
"params": [
{
"type": "Identifier",
"name": "count",
"range": [
1489,
1494
],
"loc": {
"start": {
"line": 37,
"column": 21
},
"end": {
"line": 37,
"column": 26
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "IfStatement",
"test": {
"type": "BinaryExpression",
"operator": "===",
"left": {
"type": "Identifier",
"name": "count",
"range": [
1506,
1511
],
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 13
}
}
},
"right": {
"type": "Literal",
"value": 0,
"raw": "0",
"range": [
1516,
1517
],
"loc": {
"start": {
"line": 38,
"column": 18
},
"end": {
"line": 38,
"column": 19
}
}
},
"range": [
1506,
1517
],
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 19
}
}
},
"consequent": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "EmptyObservable",
"range": [
1540,
1555
],
"loc": {
"start": {
"line": 39,
"column": 19
},
"end": {
"line": 39,
"column": 34
}
}
},
"arguments": [],
"range": [
1536,
1557
],
"loc": {
"start": {
"line": 39,
"column": 15
},
"end": {
"line": 39,
"column": 36
}
}
},
"range": [
1529,
1558
],
"loc": {
"start": {
"line": 39,
"column": 8
},
"end": {
"line": 39,
"column": 37
}
}
}
],
"range": [
1519,
1564
],
"loc": {
"start": {
"line": 38,
"column": 21
},
"end": {
"line": 40,
"column": 5
}
}
},
"alternate": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1591,
1595
],
"loc": {
"start": {
"line": 42,
"column": 15
},
"end": {
"line": 42,
"column": 19
}
}
},
"property": {
"type": "Identifier",
"name": "lift",
"range": [
1596,
1600
],
"loc": {
"start": {
"line": 42,
"column": 20
},
"end": {
"line": 42,
"column": 24
}
}
},
"range": [
1591,
1600
],
"loc": {
"start": {
"line": 42,
"column": 15
},
"end": {
"line": 42,
"column": 24
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "TakeOperator",
"range": [
1605,
1617
],
"loc": {
"start": {
"line": 42,
"column": 29
},
"end": {
"line": 42,
"column": 41
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "count",
"range": [
1618,
1623
],
"loc": {
"start": {
"line": 42,
"column": 42
},
"end": {
"line": 42,
"column": 47
}
}
}
],
"range": [
1601,
1624
],
"loc": {
"start": {
"line": 42,
"column": 25
},
"end": {
"line": 42,
"column": 48
}
}
}
],
"range": [
1591,
1625
],
"loc": {
"start": {
"line": 42,
"column": 15
},
"end": {
"line": 42,
"column": 49
}
}
},
"range": [
1584,
1626
],
"loc": {
"start": {
"line": 42,
"column": 8
},
"end": {
"line": 42,
"column": 50
}
}
}
],
"range": [
1574,
1632
],
"loc": {
"start": {
"line": 41,
"column": 9
},
"end": {
"line": 43,
"column": 5
}
}
},
"range": [
1502,
1632
],
"loc": {
"start": {
"line": 38,
"column": 4
},
"end": {
"line": 43,
"column": 5
}
}
}
],
"range": [
1496,
1634
],
"loc": {
"start": {
"line": 37,
"column": 28
},
"end": {
"line": 44,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
1475,
1634
],
"loc": {
"start": {
"line": 37,
"column": 7
},
"end": {
"line": 44,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Emits only the first `count` values emitted by the source Observable.\n *\n * <span class=\"informal\">Takes the first `count` values from the source, then\n * completes.</span>\n *\n * <img src=\"./img/take.png\" width=\"100%\">\n *\n * `take` returns an Observable that emits only the first `count` values emitted\n * by the source Observable. If the source emits fewer than `count` values then\n * all of its values are emitted. After that, it completes, regardless if the\n * source completes.\n *\n * @example <caption>Take the first 5 seconds of an infinite 1-second interval Observable</caption>\n * var interval = Rx.Observable.interval(1000);\n * var five = interval.take(5);\n * five.subscribe(x => console.log(x));\n *\n * @see {@link takeLast}\n * @see {@link takeUntil}\n * @see {@link takeWhile}\n * @see {@link skip}\n *\n * @throws {ArgumentOutOfRangeError} When using `take(i)`, it delivers an\n * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`.\n *\n * @param {number} count The maximum number of `next` values to emit.\n * @return {Observable<T>} An Observable that emits only the first `count`\n * values emitted by the source Observable, or all of the values from the source\n * if the source emits fewer than `count` values.\n * @method take\n * @owner Observable\n ",
"range": [
184,
1467
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 36,
"column": 3
}
}
}
],
"trailingComments": []
},
"specifiers": [],
"source": null,
"range": [
1468,
1634
],
"loc": {
"start": {
"line": 37,
"column": 0
},
"end": {
"line": 44,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Emits only the first `count` values emitted by the source Observable.\n *\n * <span class=\"informal\">Takes the first `count` values from the source, then\n * completes.</span>\n *\n * <img src=\"./img/take.png\" width=\"100%\">\n *\n * `take` returns an Observable that emits only the first `count` values emitted\n * by the source Observable. If the source emits fewer than `count` values then\n * all of its values are emitted. After that, it completes, regardless if the\n * source completes.\n *\n * @example <caption>Take the first 5 seconds of an infinite 1-second interval Observable</caption>\n * var interval = Rx.Observable.interval(1000);\n * var five = interval.take(5);\n * five.subscribe(x => console.log(x));\n *\n * @see {@link takeLast}\n * @see {@link takeUntil}\n * @see {@link takeWhile}\n * @see {@link skip}\n *\n * @throws {ArgumentOutOfRangeError} When using `take(i)`, it delivers an\n * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`.\n *\n * @param {number} count The maximum number of `next` values to emit.\n * @return {Observable<T>} An Observable that emits only the first `count`\n * values emitted by the source Observable, or all of the values from the source\n * if the source emits fewer than `count` values.\n * @method take\n * @owner Observable\n ",
"range": [
184,
1467
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 36,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "TakeOperator",
"range": [
1639,
1651
],
"loc": {
"start": {
"line": 45,
"column": 4
},
"end": {
"line": 45,
"column": 16
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "TakeOperator",
"range": [
1682,
1694
],
"loc": {
"start": {
"line": 46,
"column": 13
},
"end": {
"line": 46,
"column": 25
}
}
},
"params": [
{
"type": "Identifier",
"name": "total",
"range": [
1695,
1700
],
"loc": {
"start": {
"line": 46,
"column": 26
},
"end": {
"line": 46,
"column": 31
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1712,
1716
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "total",
"range": [
1717,
1722
],
"loc": {
"start": {
"line": 47,
"column": 13
},
"end": {
"line": 47,
"column": 18
}
}
},
"range": [
1712,
1722
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 18
}
}
},
"right": {
"type": "Identifier",
"name": "total",
"range": [
1725,
1730
],
"loc": {
"start": {
"line": 47,
"column": 21
},
"end": {
"line": 47,
"column": 26
}
}
},
"range": [
1712,
1730
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 26
}
}
},
"range": [
1712,
1731
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 27
}
}
},
{
"type": "IfStatement",
"test": {
"type": "BinaryExpression",
"operator": "<",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1744,
1748
],
"loc": {
"start": {
"line": 48,
"column": 12
},
"end": {
"line": 48,
"column": 16
}
}
},
"property": {
"type": "Identifier",
"name": "total",
"range": [
1749,
1754
],
"loc": {
"start": {
"line": 48,
"column": 17
},
"end": {
"line": 48,
"column": 22
}
}
},
"range": [
1744,
1754
],
"loc": {
"start": {
"line": 48,
"column": 12
},
"end": {
"line": 48,
"column": 22
}
}
},
"right": {
"type": "Literal",
"value": 0,
"raw": "0",
"range": [
1757,
1758
],
"loc": {
"start": {
"line": 48,
"column": 25
},
"end": {
"line": 48,
"column": 26
}
}
},
"range": [
1744,
1758
],
"loc": {
"start": {
"line": 48,
"column": 12
},
"end": {
"line": 48,
"column": 26
}
}
},
"consequent": {
"type": "BlockStatement",
"body": [
{
"type": "ThrowStatement",
"argument": {
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "ArgumentOutOfRangeError",
"range": [
1784,
1807
],
"loc": {
"start": {
"line": 49,
"column": 22
},
"end": {
"line": 49,
"column": 45
}
}
},
"arguments": [],
"range": [
1780,
1807
],
"loc": {
"start": {
"line": 49,
"column": 18
},
"end": {
"line": 49,
"column": 45
}
}
},
"range": [
1774,
1808
],
"loc": {
"start": {
"line": 49,
"column": 12
},
"end": {
"line": 49,
"column": 46
}
}
}
],
"range": [
1760,
1818
],
"loc": {
"start": {
"line": 48,
"column": 28
},
"end": {
"line": 50,
"column": 9
}
}
},
"alternate": null,
"range": [
1740,
1818
],
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 50,
"column": 9
}
}
}
],
"range": [
1702,
1824
],
"loc": {
"start": {
"line": 46,
"column": 33
},
"end": {
"line": 51,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
1673,
1824
],
"loc": {
"start": {
"line": 46,
"column": 4
},
"end": {
"line": 51,
"column": 5
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "TakeOperator",
"range": [
1829,
1841
],
"loc": {
"start": {
"line": 52,
"column": 4
},
"end": {
"line": 52,
"column": 16
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
1842,
1851
],
"loc": {
"start": {
"line": 52,
"column": 17
},
"end": {
"line": 52,
"column": 26
}
}
},
"range": [
1829,
1851
],
"loc": {
"start": {
"line": 52,
"column": 4
},
"end": {
"line": 52,
"column": 26
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
1852,
1856
],
"loc": {
"start": {
"line": 52,
"column": 27
},
"end": {
"line": 52,
"column": 31
}
}
},
"range": [
1829,
1856
],
"loc": {
"start": {
"line": 52,
"column": 4
},
"end": {
"line": 52,
"column": 31
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
1869,
1879
],
"loc": {
"start": {
"line": 52,
"column": 44
},
"end": {
"line": 52,
"column": 54
}
}
},
{
"type": "Identifier",
"name": "source",
"range": [
1881,
1887
],
"loc": {
"start": {
"line": 52,
"column": 56
},
"end": {
"line": 52,
"column": 62
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "source",
"range": [
1906,
1912
],
"loc": {
"start": {
"line": 53,
"column": 15
},
"end": {
"line": 53,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"name": "_subscribe",
"range": [
1913,
1923
],
"loc": {
"start": {
"line": 53,
"column": 22
},
"end": {
"line": 53,
"column": 32
}
}
},
"range": [
1906,
1923
],
"loc": {
"start": {
"line": 53,
"column": 15
},
"end": {
"line": 53,
"column": 32
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "TakeSubscriber",
"range": [
1928,
1942
],
"loc": {
"start": {
"line": 53,
"column": 37
},
"end": {
"line": 53,
"column": 51
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
1943,
1953
],
"loc": {
"start": {
"line": 53,
"column": 52
},
"end": {
"line": 53,
"column": 62
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1955,
1959
],
"loc": {
"start": {
"line": 53,
"column": 64
},
"end": {
"line": 53,
"column": 68
}
}
},
"property": {
"type": "Identifier",
"name": "total",
"range": [
1960,
1965
],
"loc": {
"start": {
"line": 53,
"column": 69
},
"end": {
"line": 53,
"column": 74
}
}
},
"range": [
1955,
1965
],
"loc": {
"start": {
"line": 53,
"column": 64
},
"end": {
"line": 53,
"column": 74
}
}
}
],
"range": [