@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,407 lines (1,406 loc) • 208 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 last `count` values emitted by the source Observable.\n *\n * <span class=\"informal\">Remembers the latest `count` values, then emits those\n * only when the source completes.</span>\n *\n * <img src=\"./img/takeLast.png\" width=\"100%\">\n *\n * `takeLast` returns an Observable that emits at most the last `count` values\n * emitted by the source Observable. If the source emits fewer than `count`\n * values then all of its values are emitted. This operator must wait until the\n * `complete` notification emission from the source in order to emit the `next`\n * values on the output Observable, because otherwise it is impossible to know\n * whether or not more values will be emitted on the source. For this reason,\n * all values are emitted synchronously, followed by the complete notification.\n *\n * @example <caption>Take the last 3 values of an Observable with many values</caption>\n * var many = Rx.Observable.range(1, 100);\n * var lastThree = many.takeLast(3);\n * lastThree.subscribe(x => console.log(x));\n *\n * @see {@link take}\n * @see {@link takeUntil}\n * @see {@link takeWhile}\n * @see {@link skip}\n *\n * @throws {ArgumentOutOfRangeError} When using `takeLast(i)`, it delivers an\n * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`.\n *\n * @param {number} count The maximum number of values to emit from the end of\n * the sequence of values emitted by the source Observable.\n * @return {Observable<T>} An Observable that emits at most the last count\n * values emitted by the source Observable.\n * @method takeLast\n * @owner Observable\n ",
"range": [
184,
1762
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 39,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "takeLast",
"range": [
1779,
1787
],
"loc": {
"start": {
"line": 40,
"column": 16
},
"end": {
"line": 40,
"column": 24
}
}
},
"params": [
{
"type": "Identifier",
"name": "count",
"range": [
1788,
1793
],
"loc": {
"start": {
"line": 40,
"column": 25
},
"end": {
"line": 40,
"column": 30
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "IfStatement",
"test": {
"type": "BinaryExpression",
"operator": "===",
"left": {
"type": "Identifier",
"name": "count",
"range": [
1805,
1810
],
"loc": {
"start": {
"line": 41,
"column": 8
},
"end": {
"line": 41,
"column": 13
}
}
},
"right": {
"type": "Literal",
"value": 0,
"raw": "0",
"range": [
1815,
1816
],
"loc": {
"start": {
"line": 41,
"column": 18
},
"end": {
"line": 41,
"column": 19
}
}
},
"range": [
1805,
1816
],
"loc": {
"start": {
"line": 41,
"column": 8
},
"end": {
"line": 41,
"column": 19
}
}
},
"consequent": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "EmptyObservable",
"range": [
1839,
1854
],
"loc": {
"start": {
"line": 42,
"column": 19
},
"end": {
"line": 42,
"column": 34
}
}
},
"arguments": [],
"range": [
1835,
1856
],
"loc": {
"start": {
"line": 42,
"column": 15
},
"end": {
"line": 42,
"column": 36
}
}
},
"range": [
1828,
1857
],
"loc": {
"start": {
"line": 42,
"column": 8
},
"end": {
"line": 42,
"column": 37
}
}
}
],
"range": [
1818,
1863
],
"loc": {
"start": {
"line": 41,
"column": 21
},
"end": {
"line": 43,
"column": 5
}
}
},
"alternate": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1890,
1894
],
"loc": {
"start": {
"line": 45,
"column": 15
},
"end": {
"line": 45,
"column": 19
}
}
},
"property": {
"type": "Identifier",
"name": "lift",
"range": [
1895,
1899
],
"loc": {
"start": {
"line": 45,
"column": 20
},
"end": {
"line": 45,
"column": 24
}
}
},
"range": [
1890,
1899
],
"loc": {
"start": {
"line": 45,
"column": 15
},
"end": {
"line": 45,
"column": 24
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "TakeLastOperator",
"range": [
1904,
1920
],
"loc": {
"start": {
"line": 45,
"column": 29
},
"end": {
"line": 45,
"column": 45
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "count",
"range": [
1921,
1926
],
"loc": {
"start": {
"line": 45,
"column": 46
},
"end": {
"line": 45,
"column": 51
}
}
}
],
"range": [
1900,
1927
],
"loc": {
"start": {
"line": 45,
"column": 25
},
"end": {
"line": 45,
"column": 52
}
}
}
],
"range": [
1890,
1928
],
"loc": {
"start": {
"line": 45,
"column": 15
},
"end": {
"line": 45,
"column": 53
}
}
},
"range": [
1883,
1929
],
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 54
}
}
}
],
"range": [
1873,
1935
],
"loc": {
"start": {
"line": 44,
"column": 9
},
"end": {
"line": 46,
"column": 5
}
}
},
"range": [
1801,
1935
],
"loc": {
"start": {
"line": 41,
"column": 4
},
"end": {
"line": 46,
"column": 5
}
}
}
],
"range": [
1795,
1937
],
"loc": {
"start": {
"line": 40,
"column": 32
},
"end": {
"line": 47,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
1770,
1937
],
"loc": {
"start": {
"line": 40,
"column": 7
},
"end": {
"line": 47,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Emits only the last `count` values emitted by the source Observable.\n *\n * <span class=\"informal\">Remembers the latest `count` values, then emits those\n * only when the source completes.</span>\n *\n * <img src=\"./img/takeLast.png\" width=\"100%\">\n *\n * `takeLast` returns an Observable that emits at most the last `count` values\n * emitted by the source Observable. If the source emits fewer than `count`\n * values then all of its values are emitted. This operator must wait until the\n * `complete` notification emission from the source in order to emit the `next`\n * values on the output Observable, because otherwise it is impossible to know\n * whether or not more values will be emitted on the source. For this reason,\n * all values are emitted synchronously, followed by the complete notification.\n *\n * @example <caption>Take the last 3 values of an Observable with many values</caption>\n * var many = Rx.Observable.range(1, 100);\n * var lastThree = many.takeLast(3);\n * lastThree.subscribe(x => console.log(x));\n *\n * @see {@link take}\n * @see {@link takeUntil}\n * @see {@link takeWhile}\n * @see {@link skip}\n *\n * @throws {ArgumentOutOfRangeError} When using `takeLast(i)`, it delivers an\n * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`.\n *\n * @param {number} count The maximum number of values to emit from the end of\n * the sequence of values emitted by the source Observable.\n * @return {Observable<T>} An Observable that emits at most the last count\n * values emitted by the source Observable.\n * @method takeLast\n * @owner Observable\n ",
"range": [
184,
1762
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 39,
"column": 3
}
}
}
],
"trailingComments": []
},
"specifiers": [],
"source": null,
"range": [
1763,
1937
],
"loc": {
"start": {
"line": 40,
"column": 0
},
"end": {
"line": 47,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Emits only the last `count` values emitted by the source Observable.\n *\n * <span class=\"informal\">Remembers the latest `count` values, then emits those\n * only when the source completes.</span>\n *\n * <img src=\"./img/takeLast.png\" width=\"100%\">\n *\n * `takeLast` returns an Observable that emits at most the last `count` values\n * emitted by the source Observable. If the source emits fewer than `count`\n * values then all of its values are emitted. This operator must wait until the\n * `complete` notification emission from the source in order to emit the `next`\n * values on the output Observable, because otherwise it is impossible to know\n * whether or not more values will be emitted on the source. For this reason,\n * all values are emitted synchronously, followed by the complete notification.\n *\n * @example <caption>Take the last 3 values of an Observable with many values</caption>\n * var many = Rx.Observable.range(1, 100);\n * var lastThree = many.takeLast(3);\n * lastThree.subscribe(x => console.log(x));\n *\n * @see {@link take}\n * @see {@link takeUntil}\n * @see {@link takeWhile}\n * @see {@link skip}\n *\n * @throws {ArgumentOutOfRangeError} When using `takeLast(i)`, it delivers an\n * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`.\n *\n * @param {number} count The maximum number of values to emit from the end of\n * the sequence of values emitted by the source Observable.\n * @return {Observable<T>} An Observable that emits at most the last count\n * values emitted by the source Observable.\n * @method takeLast\n * @owner Observable\n ",
"range": [
184,
1762
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 39,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "TakeLastOperator",
"range": [
1942,
1958
],
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 48,
"column": 20
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "TakeLastOperator",
"range": [
1989,
2005
],
"loc": {
"start": {
"line": 49,
"column": 13
},
"end": {
"line": 49,
"column": 29
}
}
},
"params": [
{
"type": "Identifier",
"name": "total",
"range": [
2006,
2011
],
"loc": {
"start": {
"line": 49,
"column": 30
},
"end": {
"line": 49,
"column": 35
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2023,
2027
],
"loc": {
"start": {
"line": 50,
"column": 8
},
"end": {
"line": 50,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "total",
"range": [
2028,
2033
],
"loc": {
"start": {
"line": 50,
"column": 13
},
"end": {
"line": 50,
"column": 18
}
}
},
"range": [
2023,
2033
],
"loc": {
"start": {
"line": 50,
"column": 8
},
"end": {
"line": 50,
"column": 18
}
}
},
"right": {
"type": "Identifier",
"name": "total",
"range": [
2036,
2041
],
"loc": {
"start": {
"line": 50,
"column": 21
},
"end": {
"line": 50,
"column": 26
}
}
},
"range": [
2023,
2041
],
"loc": {
"start": {
"line": 50,
"column": 8
},
"end": {
"line": 50,
"column": 26
}
}
},
"range": [
2023,
2042
],
"loc": {
"start": {
"line": 50,
"column": 8
},
"end": {
"line": 50,
"column": 27
}
}
},
{
"type": "IfStatement",
"test": {
"type": "BinaryExpression",
"operator": "<",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2055,
2059
],
"loc": {
"start": {
"line": 51,
"column": 12
},
"end": {
"line": 51,
"column": 16
}
}
},
"property": {
"type": "Identifier",
"name": "total",
"range": [
2060,
2065
],
"loc": {
"start": {
"line": 51,
"column": 17
},
"end": {
"line": 51,
"column": 22
}
}
},
"range": [
2055,
2065
],
"loc": {
"start": {
"line": 51,
"column": 12
},
"end": {
"line": 51,
"column": 22
}
}
},
"right": {
"type": "Literal",
"value": 0,
"raw": "0",
"range": [
2068,
2069
],
"loc": {
"start": {
"line": 51,
"column": 25
},
"end": {
"line": 51,
"column": 26
}
}
},
"range": [
2055,
2069
],
"loc": {
"start": {
"line": 51,
"column": 12
},
"end": {
"line": 51,
"column": 26
}
}
},
"consequent": {
"type": "BlockStatement",
"body": [
{
"type": "ThrowStatement",
"argument": {
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "ArgumentOutOfRangeError",
"range": [
2095,
2118
],
"loc": {
"start": {
"line": 52,
"column": 22
},
"end": {
"line": 52,
"column": 45
}
}
},
"arguments": [],
"range": [
2091,
2118
],
"loc": {
"start": {
"line": 52,
"column": 18
},
"end": {
"line": 52,
"column": 45
}
}
},
"range": [
2085,
2119
],
"loc": {
"start": {
"line": 52,
"column": 12
},
"end": {
"line": 52,
"column": 46
}
}
}
],
"range": [
2071,
2129
],
"loc": {
"start": {
"line": 51,
"column": 28
},
"end": {
"line": 53,
"column": 9
}
}
},
"alternate": null,
"range": [
2051,
2129
],
"loc": {
"start": {
"line": 51,
"column": 8
},
"end": {
"line": 53,
"column": 9
}
}
}
],
"range": [
2013,
2135
],
"loc": {
"start": {
"line": 49,
"column": 37
},
"end": {
"line": 54,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
1980,
2135
],
"loc": {
"start": {
"line": 49,
"column": 4
},
"end": {
"line": 54,
"column": 5
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "TakeLastOperator",
"range": [
2140,
2156
],
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 55,
"column": 20
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
2157,
2166
],
"loc": {
"start": {
"line": 55,
"column": 21
},
"end": {
"line": 55,
"column": 30
}
}
},
"range": [
2140,
2166
],
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 55,
"column": 30
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
2167,
2171
],
"loc": {
"start": {
"line": 55,
"column": 31
},
"end": {
"line": 55,
"column": 35
}
}
},
"range": [
2140,
2171
],
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 55,
"column": 35
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2184,
2194
],
"loc": {
"start": {
"line": 55,
"column": 48
},
"end": {
"line": 55,
"column": 58
}
}
},
{
"type": "Identifier",
"name": "source",
"range": [
2196,
2202
],
"loc": {
"start": {
"line": 55,
"column": 60
},
"end": {
"line": 55,
"column": 66
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "source",
"range": [
2221,
2227
],
"loc": {
"start": {
"line": 56,
"column": 15
},
"end": {
"line": 56,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"name": "_subscribe",
"range": [
2228,
2238
],
"loc": {
"start": {
"line": 56,
"column": 22
},
"end": {
"line": 56,
"column": 32
}
}
},
"range": [
2221,
2238
],
"loc": {
"start": {
"line": 56,
"column": 15
},
"end": {
"line": 56,
"column": 32
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "TakeLastSubscriber",
"range": [
2243,
2261
],
"loc": {
"start": {
"line": 56,
"column": 37
},
"end": {
"line": 56,
"column": 55
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2262,
2272
],
"loc": {
"start": {
"line": 56,
"column": 56
},
"end": {
"line": 56,
"column": 66
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2274,
2278
],
"loc": {
"start": {
"line": 56,
"column": 68
},
"end": {
"line": 56,
"column": 72
}
}
},
"property": {
"type": "Identifier",
"name": "total",
"range": [
2279,
2284
],
"loc": {
"start": {
"line": 56,
"column": 73
},
"end": {
"line": 56,
"column": 78
}