@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,286 lines (1,285 loc) • 172 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
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * Counts the number of emissions on the source and emits that number when the\n * source completes.\n *\n * <span class=\"informal\">Tells how many values were emitted, when the source\n * completes.</span>\n *\n * <img src=\"./img/count.png\" width=\"100%\">\n *\n * `count` transforms an Observable that emits values into an Observable that\n * emits a single value that represents the number of values emitted by the\n * source Observable. If the source Observable terminates with an error, `count`\n * will pass this error notification along without emitting an value first. If\n * the source Observable does not terminate at all, `count` will neither emit\n * a value nor terminate. This operator takes an optional `predicate` function\n * as argument, in which case the output emission will represent the number of\n * source values that matched `true` with the `predicate`.\n *\n * @example <caption>Counts how many seconds have passed before the first click happened</caption>\n * var seconds = Rx.Observable.interval(1000);\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var secondsBeforeClick = seconds.takeUntil(clicks);\n * var result = secondsBeforeClick.count();\n * result.subscribe(x => console.log(x));\n *\n * @example <caption>Counts how many odd numbers are there between 1 and 7</caption>\n * var numbers = Rx.Observable.range(1, 7);\n * var result = numbers.count(i => i % 2 === 1);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link max}\n * @see {@link min}\n * @see {@link reduce}\n *\n * @param {function(value: T, i: number, source: Observable<T>): boolean} [predicate] A\n * boolean function to select what values are to be counted. It is provided with\n * arguments of:\n * - `value`: the value from the source Observable.\n * - `index`: the (zero-based) \"index\" of the value from the source Observable.\n * - `source`: the source Observable instance itself.\n * @return {Observable} An Observable of one number that represents the count as\n * described above.\n * @method count\n * @owner Observable\n ",
"range": [
44,
2065
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 46,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "count",
"range": [
2082,
2087
],
"loc": {
"start": {
"line": 47,
"column": 16
},
"end": {
"line": 47,
"column": 21
}
}
},
"params": [
{
"type": "Identifier",
"name": "predicate",
"range": [
2088,
2097
],
"loc": {
"start": {
"line": 47,
"column": 22
},
"end": {
"line": 47,
"column": 31
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2112,
2116
],
"loc": {
"start": {
"line": 48,
"column": 11
},
"end": {
"line": 48,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"name": "lift",
"range": [
2117,
2121
],
"loc": {
"start": {
"line": 48,
"column": 16
},
"end": {
"line": 48,
"column": 20
}
}
},
"range": [
2112,
2121
],
"loc": {
"start": {
"line": 48,
"column": 11
},
"end": {
"line": 48,
"column": 20
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "CountOperator",
"range": [
2126,
2139
],
"loc": {
"start": {
"line": 48,
"column": 25
},
"end": {
"line": 48,
"column": 38
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "predicate",
"range": [
2140,
2149
],
"loc": {
"start": {
"line": 48,
"column": 39
},
"end": {
"line": 48,
"column": 48
}
}
},
{
"type": "ThisExpression",
"range": [
2151,
2155
],
"loc": {
"start": {
"line": 48,
"column": 50
},
"end": {
"line": 48,
"column": 54
}
}
}
],
"range": [
2122,
2156
],
"loc": {
"start": {
"line": 48,
"column": 21
},
"end": {
"line": 48,
"column": 55
}
}
}
],
"range": [
2112,
2157
],
"loc": {
"start": {
"line": 48,
"column": 11
},
"end": {
"line": 48,
"column": 56
}
}
},
"range": [
2105,
2158
],
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 48,
"column": 57
}
}
}
],
"range": [
2099,
2160
],
"loc": {
"start": {
"line": 47,
"column": 33
},
"end": {
"line": 49,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
2073,
2160
],
"loc": {
"start": {
"line": 47,
"column": 7
},
"end": {
"line": 49,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Counts the number of emissions on the source and emits that number when the\n * source completes.\n *\n * <span class=\"informal\">Tells how many values were emitted, when the source\n * completes.</span>\n *\n * <img src=\"./img/count.png\" width=\"100%\">\n *\n * `count` transforms an Observable that emits values into an Observable that\n * emits a single value that represents the number of values emitted by the\n * source Observable. If the source Observable terminates with an error, `count`\n * will pass this error notification along without emitting an value first. If\n * the source Observable does not terminate at all, `count` will neither emit\n * a value nor terminate. This operator takes an optional `predicate` function\n * as argument, in which case the output emission will represent the number of\n * source values that matched `true` with the `predicate`.\n *\n * @example <caption>Counts how many seconds have passed before the first click happened</caption>\n * var seconds = Rx.Observable.interval(1000);\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var secondsBeforeClick = seconds.takeUntil(clicks);\n * var result = secondsBeforeClick.count();\n * result.subscribe(x => console.log(x));\n *\n * @example <caption>Counts how many odd numbers are there between 1 and 7</caption>\n * var numbers = Rx.Observable.range(1, 7);\n * var result = numbers.count(i => i % 2 === 1);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link max}\n * @see {@link min}\n * @see {@link reduce}\n *\n * @param {function(value: T, i: number, source: Observable<T>): boolean} [predicate] A\n * boolean function to select what values are to be counted. It is provided with\n * arguments of:\n * - `value`: the value from the source Observable.\n * - `index`: the (zero-based) \"index\" of the value from the source Observable.\n * - `source`: the source Observable instance itself.\n * @return {Observable} An Observable of one number that represents the count as\n * described above.\n * @method count\n * @owner Observable\n ",
"range": [
44,
2065
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 46,
"column": 3
}
}
}
],
"trailingComments": []
},
"specifiers": [],
"source": null,
"range": [
2066,
2160
],
"loc": {
"start": {
"line": 47,
"column": 0
},
"end": {
"line": 49,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Counts the number of emissions on the source and emits that number when the\n * source completes.\n *\n * <span class=\"informal\">Tells how many values were emitted, when the source\n * completes.</span>\n *\n * <img src=\"./img/count.png\" width=\"100%\">\n *\n * `count` transforms an Observable that emits values into an Observable that\n * emits a single value that represents the number of values emitted by the\n * source Observable. If the source Observable terminates with an error, `count`\n * will pass this error notification along without emitting an value first. If\n * the source Observable does not terminate at all, `count` will neither emit\n * a value nor terminate. This operator takes an optional `predicate` function\n * as argument, in which case the output emission will represent the number of\n * source values that matched `true` with the `predicate`.\n *\n * @example <caption>Counts how many seconds have passed before the first click happened</caption>\n * var seconds = Rx.Observable.interval(1000);\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var secondsBeforeClick = seconds.takeUntil(clicks);\n * var result = secondsBeforeClick.count();\n * result.subscribe(x => console.log(x));\n *\n * @example <caption>Counts how many odd numbers are there between 1 and 7</caption>\n * var numbers = Rx.Observable.range(1, 7);\n * var result = numbers.count(i => i % 2 === 1);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link max}\n * @see {@link min}\n * @see {@link reduce}\n *\n * @param {function(value: T, i: number, source: Observable<T>): boolean} [predicate] A\n * boolean function to select what values are to be counted. It is provided with\n * arguments of:\n * - `value`: the value from the source Observable.\n * - `index`: the (zero-based) \"index\" of the value from the source Observable.\n * - `source`: the source Observable instance itself.\n * @return {Observable} An Observable of one number that represents the count as\n * described above.\n * @method count\n * @owner Observable\n ",
"range": [
44,
2065
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 46,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "CountOperator",
"range": [
2165,
2178
],
"loc": {
"start": {
"line": 50,
"column": 4
},
"end": {
"line": 50,
"column": 17
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "CountOperator",
"range": [
2209,
2222
],
"loc": {
"start": {
"line": 51,
"column": 13
},
"end": {
"line": 51,
"column": 26
}
}
},
"params": [
{
"type": "Identifier",
"name": "predicate",
"range": [
2223,
2232
],
"loc": {
"start": {
"line": 51,
"column": 27
},
"end": {
"line": 51,
"column": 36
}
}
},
{
"type": "Identifier",
"name": "source",
"range": [
2234,
2240
],
"loc": {
"start": {
"line": 51,
"column": 38
},
"end": {
"line": 51,
"column": 44
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2252,
2256
],
"loc": {
"start": {
"line": 52,
"column": 8
},
"end": {
"line": 52,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "predicate",
"range": [
2257,
2266
],
"loc": {
"start": {
"line": 52,
"column": 13
},
"end": {
"line": 52,
"column": 22
}
}
},
"range": [
2252,
2266
],
"loc": {
"start": {
"line": 52,
"column": 8
},
"end": {
"line": 52,
"column": 22
}
}
},
"right": {
"type": "Identifier",
"name": "predicate",
"range": [
2269,
2278
],
"loc": {
"start": {
"line": 52,
"column": 25
},
"end": {
"line": 52,
"column": 34
}
}
},
"range": [
2252,
2278
],
"loc": {
"start": {
"line": 52,
"column": 8
},
"end": {
"line": 52,
"column": 34
}
}
},
"range": [
2252,
2279
],
"loc": {
"start": {
"line": 52,
"column": 8
},
"end": {
"line": 52,
"column": 35
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2288,
2292
],
"loc": {
"start": {
"line": 53,
"column": 8
},
"end": {
"line": 53,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "source",
"range": [
2293,
2299
],
"loc": {
"start": {
"line": 53,
"column": 13
},
"end": {
"line": 53,
"column": 19
}
}
},
"range": [
2288,
2299
],
"loc": {
"start": {
"line": 53,
"column": 8
},
"end": {
"line": 53,
"column": 19
}
}
},
"right": {
"type": "Identifier",
"name": "source",
"range": [
2302,
2308
],
"loc": {
"start": {
"line": 53,
"column": 22
},
"end": {
"line": 53,
"column": 28
}
}
},
"range": [
2288,
2308
],
"loc": {
"start": {
"line": 53,
"column": 8
},
"end": {
"line": 53,
"column": 28
}
}
},
"range": [
2288,
2309
],
"loc": {
"start": {
"line": 53,
"column": 8
},
"end": {
"line": 53,
"column": 29
}
}
}
],
"range": [
2242,
2315
],
"loc": {
"start": {
"line": 51,
"column": 46
},
"end": {
"line": 54,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
2200,
2315
],
"loc": {
"start": {
"line": 51,
"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": "CountOperator",
"range": [
2320,
2333
],
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 55,
"column": 17
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
2334,
2343
],
"loc": {
"start": {
"line": 55,
"column": 18
},
"end": {
"line": 55,
"column": 27
}
}
},
"range": [
2320,
2343
],
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 55,
"column": 27
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
2344,
2348
],
"loc": {
"start": {
"line": 55,
"column": 28
},
"end": {
"line": 55,
"column": 32
}
}
},
"range": [
2320,
2348
],
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 55,
"column": 32
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2361,
2371
],
"loc": {
"start": {
"line": 55,
"column": 45
},
"end": {
"line": 55,
"column": 55
}
}
},
{
"type": "Identifier",
"name": "source",
"range": [
2373,
2379
],
"loc": {
"start": {
"line": 55,
"column": 57
},
"end": {
"line": 55,
"column": 63
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "source",
"range": [
2398,
2404
],
"loc": {
"start": {
"line": 56,
"column": 15
},
"end": {
"line": 56,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"name": "_subscribe",
"range": [
2405,
2415
],
"loc": {
"start": {
"line": 56,
"column": 22
},
"end": {
"line": 56,
"column": 32
}
}
},
"range": [
2398,
2415
],
"loc": {
"start": {
"line": 56,
"column": 15
},
"end": {
"line": 56,
"column": 32
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "CountSubscriber",
"range": [
2420,
2435
],
"loc": {
"start": {
"line": 56,
"column": 37
},
"end": {
"line": 56,
"column": 52
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2436,
2446
],
"loc": {
"start": {
"line": 56,
"column": 53
},
"end": {
"line": 56,
"column": 63
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2448,
2452
],
"loc": {
"start": {
"line": 56,
"column": 65
},
"end": {
"line": 56,
"column": 69
}
}
},
"property": {
"type": "Identifier",
"name": "predicate",
"range": [
2453,
2462
],
"loc": {
"start": {
"line": 56,
"column": 70
},
"end": {
"line": 56,
"column": 79
}
}
},
"range": [
2448,
2462
],
"loc": {
"start": {
"line": 56,
"column": 65
},
"end": {
"line": 56,
"column": 79
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2464,
2468
],
"loc": {
"start": {
"line": 56,
"column": 81
},
"end": {
"line": 56,
"column": 85
}
}
},
"property": {
"type": "Identifier",
"name": "source",
"range": [
2469,
2475
],
"loc": {
"start": {
"line": 56,
"column": 86
},
"end": {
"line": 56,
"column": 92
}
}
},
"range": [
2464,
2475
],
"loc": {
"start": {
"line": 56,
"column": 81
},
"end": {
"line": 56,
"column": 92
}
}
}
],
"range": [
2416,
2476
],
"loc": {
"start": {
"line": 56,
"column": 33
},
"end": {
"line": 56,
"column": 93
}
}
}
],
"range": [
2398,
2477
],
"loc": {
"start": {
"line": 56,
"column": 15
},
"end": {
"line": 56,
"column": 94
}
}
},
"range": [
2391,
2478
],
"loc": {
"start": {
"line": 56,
"column": 8
},
"end": {
"line": 56,
"column": 95
}
}
}
],
"range": [
2381,
2484
],
"loc": {
"start": {
"line": 55,
"column": 65
},
"end": {
"line": 57,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
2351,
2484
],
"loc": {
"start": {
"line": 55,
"column": 35
},
"end": {
"line": 57,
"column": 5
}
}
},
"range": [
2320,
2484
],
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 57,
"column": 5
}
}
},
"range": [
2320,
2485
],
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 57,
"column": 6
}
}
},
{
"type": "ReturnStatement",
"argument": {
"type": "Identifier",
"name": "CountOperator",
"range": [
2497,
2510
],
"loc": {
"start": {
"line": 58,
"column": 11
},
"end": {
"line": 58,
"column": 24
}
}
},
"range": [
2490,
2511
],
"loc": {
"start": {
"line": 58,
"column": 4
},
"end": {
"line": 58,
"column": 25
}
}
}
],
"range": [
2194,
2513
],
"loc": {
"start": {
"line": 50,
"column": 33
},
"end": {
"line": 59,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
2182,
2513
],
"loc": {
"start": {
"line": 50,
"column": 21
},
"end": {
"line": 59,
"column": 1
}
}
},
"arguments": [],
"range": [
2182,
2515
],
"loc": {
"start": {
"line": 50,
"column": 21
},
"end": {
"line": 59,
"column": 3
}
}