@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,419 lines (1,418 loc) • 87.8 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 * Groups pairs of consecutive emissions together and emits them as an array of\n * two values.\n *\n * <span class=\"informal\">Puts the current value and previous value together as\n * an array, and emits that.</span>\n *\n * <img src=\"./img/pairwise.png\" width=\"100%\">\n *\n * The Nth emission from the source Observable will cause the output Observable\n * to emit an array [(N-1)th, Nth] of the previous and the current value, as a\n * pair. For this reason, `pairwise` emits on the second and subsequent\n * emissions from the source Observable, but not on the first emission, because\n * there is no previous value in that case.\n *\n * @example <caption>On every click (starting from the second), emit the relative distance to the previous click</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var pairs = clicks.pairwise();\n * var distance = pairs.map(pair => {\n * var x0 = pair[0].clientX;\n * var y0 = pair[0].clientY;\n * var x1 = pair[1].clientX;\n * var y1 = pair[1].clientY;\n * return Math.sqrt(Math.pow(x0 - x1, 2) + Math.pow(y0 - y1, 2));\n * });\n * distance.subscribe(x => console.log(x));\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n *\n * @return {Observable<Array<T>>} An Observable of pairs (as arrays) of\n * consecutive values from the source Observable.\n * @method pairwise\n * @owner Observable\n ",
"range": [
44,
1394
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 36,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "pairwise",
"range": [
1411,
1419
],
"loc": {
"start": {
"line": 37,
"column": 16
},
"end": {
"line": 37,
"column": 24
}
}
},
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1435,
1439
],
"loc": {
"start": {
"line": 38,
"column": 11
},
"end": {
"line": 38,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"name": "lift",
"range": [
1440,
1444
],
"loc": {
"start": {
"line": 38,
"column": 16
},
"end": {
"line": 38,
"column": 20
}
}
},
"range": [
1435,
1444
],
"loc": {
"start": {
"line": 38,
"column": 11
},
"end": {
"line": 38,
"column": 20
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "PairwiseOperator",
"range": [
1449,
1465
],
"loc": {
"start": {
"line": 38,
"column": 25
},
"end": {
"line": 38,
"column": 41
}
}
},
"arguments": [],
"range": [
1445,
1467
],
"loc": {
"start": {
"line": 38,
"column": 21
},
"end": {
"line": 38,
"column": 43
}
}
}
],
"range": [
1435,
1468
],
"loc": {
"start": {
"line": 38,
"column": 11
},
"end": {
"line": 38,
"column": 44
}
}
},
"range": [
1428,
1469
],
"loc": {
"start": {
"line": 38,
"column": 4
},
"end": {
"line": 38,
"column": 45
}
}
}
],
"range": [
1422,
1471
],
"loc": {
"start": {
"line": 37,
"column": 27
},
"end": {
"line": 39,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
1402,
1471
],
"loc": {
"start": {
"line": 37,
"column": 7
},
"end": {
"line": 39,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Groups pairs of consecutive emissions together and emits them as an array of\n * two values.\n *\n * <span class=\"informal\">Puts the current value and previous value together as\n * an array, and emits that.</span>\n *\n * <img src=\"./img/pairwise.png\" width=\"100%\">\n *\n * The Nth emission from the source Observable will cause the output Observable\n * to emit an array [(N-1)th, Nth] of the previous and the current value, as a\n * pair. For this reason, `pairwise` emits on the second and subsequent\n * emissions from the source Observable, but not on the first emission, because\n * there is no previous value in that case.\n *\n * @example <caption>On every click (starting from the second), emit the relative distance to the previous click</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var pairs = clicks.pairwise();\n * var distance = pairs.map(pair => {\n * var x0 = pair[0].clientX;\n * var y0 = pair[0].clientY;\n * var x1 = pair[1].clientX;\n * var y1 = pair[1].clientY;\n * return Math.sqrt(Math.pow(x0 - x1, 2) + Math.pow(y0 - y1, 2));\n * });\n * distance.subscribe(x => console.log(x));\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n *\n * @return {Observable<Array<T>>} An Observable of pairs (as arrays) of\n * consecutive values from the source Observable.\n * @method pairwise\n * @owner Observable\n ",
"range": [
44,
1394
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 36,
"column": 3
}
}
}
],
"trailingComments": []
},
"specifiers": [],
"source": null,
"range": [
1395,
1471
],
"loc": {
"start": {
"line": 37,
"column": 0
},
"end": {
"line": 39,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Groups pairs of consecutive emissions together and emits them as an array of\n * two values.\n *\n * <span class=\"informal\">Puts the current value and previous value together as\n * an array, and emits that.</span>\n *\n * <img src=\"./img/pairwise.png\" width=\"100%\">\n *\n * The Nth emission from the source Observable will cause the output Observable\n * to emit an array [(N-1)th, Nth] of the previous and the current value, as a\n * pair. For this reason, `pairwise` emits on the second and subsequent\n * emissions from the source Observable, but not on the first emission, because\n * there is no previous value in that case.\n *\n * @example <caption>On every click (starting from the second), emit the relative distance to the previous click</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var pairs = clicks.pairwise();\n * var distance = pairs.map(pair => {\n * var x0 = pair[0].clientX;\n * var y0 = pair[0].clientY;\n * var x1 = pair[1].clientX;\n * var y1 = pair[1].clientY;\n * return Math.sqrt(Math.pow(x0 - x1, 2) + Math.pow(y0 - y1, 2));\n * });\n * distance.subscribe(x => console.log(x));\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n *\n * @return {Observable<Array<T>>} An Observable of pairs (as arrays) of\n * consecutive values from the source Observable.\n * @method pairwise\n * @owner Observable\n ",
"range": [
44,
1394
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 36,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "PairwiseOperator",
"range": [
1476,
1492
],
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 40,
"column": 20
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "PairwiseOperator",
"range": [
1523,
1539
],
"loc": {
"start": {
"line": 41,
"column": 13
},
"end": {
"line": 41,
"column": 29
}
}
},
"params": [],
"body": {
"type": "BlockStatement",
"body": [],
"range": [
1542,
1549
],
"loc": {
"start": {
"line": 41,
"column": 32
},
"end": {
"line": 42,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
1514,
1549
],
"loc": {
"start": {
"line": 41,
"column": 4
},
"end": {
"line": 42,
"column": 5
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "PairwiseOperator",
"range": [
1554,
1570
],
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 20
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
1571,
1580
],
"loc": {
"start": {
"line": 43,
"column": 21
},
"end": {
"line": 43,
"column": 30
}
}
},
"range": [
1554,
1580
],
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 30
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
1581,
1585
],
"loc": {
"start": {
"line": 43,
"column": 31
},
"end": {
"line": 43,
"column": 35
}
}
},
"range": [
1554,
1585
],
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 35
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
1598,
1608
],
"loc": {
"start": {
"line": 43,
"column": 48
},
"end": {
"line": 43,
"column": 58
}
}
},
{
"type": "Identifier",
"name": "source",
"range": [
1610,
1616
],
"loc": {
"start": {
"line": 43,
"column": 60
},
"end": {
"line": 43,
"column": 66
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "source",
"range": [
1635,
1641
],
"loc": {
"start": {
"line": 44,
"column": 15
},
"end": {
"line": 44,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"name": "_subscribe",
"range": [
1642,
1652
],
"loc": {
"start": {
"line": 44,
"column": 22
},
"end": {
"line": 44,
"column": 32
}
}
},
"range": [
1635,
1652
],
"loc": {
"start": {
"line": 44,
"column": 15
},
"end": {
"line": 44,
"column": 32
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "PairwiseSubscriber",
"range": [
1657,
1675
],
"loc": {
"start": {
"line": 44,
"column": 37
},
"end": {
"line": 44,
"column": 55
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
1676,
1686
],
"loc": {
"start": {
"line": 44,
"column": 56
},
"end": {
"line": 44,
"column": 66
}
}
}
],
"range": [
1653,
1687
],
"loc": {
"start": {
"line": 44,
"column": 33
},
"end": {
"line": 44,
"column": 67
}
}
}
],
"range": [
1635,
1688
],
"loc": {
"start": {
"line": 44,
"column": 15
},
"end": {
"line": 44,
"column": 68
}
}
},
"range": [
1628,
1689
],
"loc": {
"start": {
"line": 44,
"column": 8
},
"end": {
"line": 44,
"column": 69
}
}
}
],
"range": [
1618,
1695
],
"loc": {
"start": {
"line": 43,
"column": 68
},
"end": {
"line": 45,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
1588,
1695
],
"loc": {
"start": {
"line": 43,
"column": 38
},
"end": {
"line": 45,
"column": 5
}
}
},
"range": [
1554,
1695
],
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 45,
"column": 5
}
}
},
"range": [
1554,
1696
],
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 45,
"column": 6
}
}
},
{
"type": "ReturnStatement",
"argument": {
"type": "Identifier",
"name": "PairwiseOperator",
"range": [
1708,
1724
],
"loc": {
"start": {
"line": 46,
"column": 11
},
"end": {
"line": 46,
"column": 27
}
}
},
"range": [
1701,
1725
],
"loc": {
"start": {
"line": 46,
"column": 4
},
"end": {
"line": 46,
"column": 28
}
}
}
],
"range": [
1508,
1727
],
"loc": {
"start": {
"line": 40,
"column": 36
},
"end": {
"line": 47,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
1496,
1727
],
"loc": {
"start": {
"line": 40,
"column": 24
},
"end": {
"line": 47,
"column": 1
}
}
},
"arguments": [],
"range": [
1496,
1729
],
"loc": {
"start": {
"line": 40,
"column": 24
},
"end": {
"line": 47,
"column": 3
}
}
},
"range": [
1476,
1730
],
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 47,
"column": 4
}
}
}
],
"kind": "var",
"range": [
1472,
1731
],
"loc": {
"start": {
"line": 40,
"column": 0
},
"end": {
"line": 47,
"column": 5
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n ",
"range": [
1732,
1823
],
"loc": {
"start": {
"line": 48,
"column": 0
},
"end": {
"line": 52,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "PairwiseSubscriber",
"range": [
1828,
1846
],
"loc": {
"start": {
"line": 53,
"column": 4
},
"end": {
"line": 53,
"column": 22
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "_super",
"range": [
1860,
1866
],
"loc": {
"start": {
"line": 53,
"column": 36
},
"end": {
"line": 53,
"column": 42
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "__extends",
"range": [
1874,
1883
],
"loc": {
"start": {
"line": 54,
"column": 4
},
"end": {
"line": 54,
"column": 13
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "PairwiseSubscriber",
"range": [
1884,
1902
],
"loc": {
"start": {
"line": 54,
"column": 14
},
"end": {
"line": 54,
"column": 32
}
}
},
{
"type": "Identifier",
"name": "_super",
"range": [
1904,
1910
],
"loc": {
"start": {
"line": 54,
"column": 34
},
"end": {
"line": 54,
"column": 40
}
}
}
],
"range": [
1874,
1911
],
"loc": {
"start": {
"line": 54,
"column": 4
},
"end": {
"line": 54,
"column": 41
}
}
},
"range": [
1874,
1912
],
"loc": {
"start": {
"line": 54,
"column": 4
},
"end": {
"line": 54,
"column": 42
}
}
},
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "PairwiseSubscriber",
"range": [
1926,
1944
],
"loc": {
"start": {
"line": 55,
"column": 13
},
"end": {
"line": 55,
"column": 31
}
}
},
"params": [
{
"type": "Identifier",
"name": "destination",
"range": [
1945,
1956
],
"loc": {
"start": {
"line": 55,
"column": 32
},
"end": {
"line": 55,
"column": 43
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "_super",
"range": [
1968,
1974
],
"loc": {
"start": {
"line": 56,
"column": 8
},
"end": {
"line": 56,
"column": 14
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
1975,
1979
],
"loc": {
"start": {
"line": 56,
"column": 15
},
"end": {
"line": 56,
"column": 19
}
}
},
"range": [
1968,
1979
],
"loc": {
"start": {
"line": 56,
"column": 8
},
"end": {
"line": 56,
"column": 19
}
}
},
"arguments": [
{
"type": "ThisExpression",
"range": [
1980,
1984
],
"loc": {
"start": {
"line": 56,
"column": 20
},
"end": {
"line": 56,
"column": 24
}
}
},
{
"type": "Identifier",
"name": "destination",
"range": [
1986,
1997
],
"loc": {
"start": {
"line": 56,
"column": 26
},
"end": {
"line": 56,
"column": 37
}
}
}
],
"range": [
1968,
1998
],
"loc": {
"start": {
"line": 56,
"column": 8
},
"end": {
"line": 56,
"column": 38
}
}
},
"range": [
1968,
1999
],
"loc": {
"start": {
"line": 56,
"column": 8
},
"end": {
"line": 56,
"column": 39
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2008,
2012
],
"loc": {
"start": {
"line": 57,
"column": 8
},
"end": {
"line": 57,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "hasPrev",
"range": [
2013,
2020
],
"loc": {
"start": {
"line": 57,
"column": 13
},
"end": {
"line": 57,
"column": 20
}
}
},
"range": [
2008,
2020
],
"loc": {
"start": {
"line": 57,
"column": 8
},
"end": {
"line": 57,
"column": 20
}
}
},
"right": {
"type": "Literal",
"value": false,
"raw": "false",
"range": [
2023,
2028
],
"loc": {
"start": {
"line": 57,
"column": 23
},
"end": {
"line": 57,
"column": 28
}
}
},
"range": [
2008,
2028
],
"loc": {
"start": {
"line": 57,
"column": 8
},
"end": {
"line": 57,
"column": 28
}
}
},
"range": [
2008,
2029
],
"loc": {
"start": {
"line": 57,
"column": 8
},
"end": {
"line": 57,
"column": 29
}
}
}
],
"range": [
1958,
2035
],
"loc": {
"start": {
"line": 55,
"column": 45
},
"end": {
"line": 58,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
1917,
2035
],
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 58,
"column": 5
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "PairwiseSubscriber",
"range": [
2040,
2058
],
"loc": {
"start": {
"line": 59,
"column": 4
},
"end": {
"line": 59,
"column": 22
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
2059,
2068
],
"loc": {
"start": {
"line": 59,
"column": 23
},
"end": {