@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,303 lines • 403 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": "tryCatch",
"range": [
53,
61
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 17
}
}
},
"imported": {
"type": "Identifier",
"name": "tryCatch",
"range": [
53,
61
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 17
}
}
},
"range": [
53,
61
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 17
}
}
}
],
"source": {
"type": "Literal",
"value": "../util/tryCatch",
"raw": "'../util/tryCatch'",
"range": [
69,
87
],
"loc": {
"start": {
"line": 2,
"column": 25
},
"end": {
"line": 2,
"column": 43
}
}
},
"range": [
44,
88
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 44
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "errorObject",
"range": [
98,
109
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 20
}
}
},
"imported": {
"type": "Identifier",
"name": "errorObject",
"range": [
98,
109
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 20
}
}
},
"range": [
98,
109
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 20
}
}
}
],
"source": {
"type": "Literal",
"value": "../util/errorObject",
"raw": "'../util/errorObject'",
"range": [
117,
138
],
"loc": {
"start": {
"line": 3,
"column": 28
},
"end": {
"line": 3,
"column": 49
}
}
},
"range": [
89,
139
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 50
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * Compares all values of two observables in sequence using an optional comparor function\n * and returns an observable of a single boolean value representing whether or not the two sequences\n * are equal.\n *\n * <span class=\"informal\">Checks to see of all values emitted by both observables are equal, in order.</span>\n *\n * <img src=\"./img/sequenceEqual.png\" width=\"100%\">\n *\n * `sequenceEqual` subscribes to two observables and buffers incoming values from each observable. Whenever either\n * observable emits a value, the value is buffered and the buffers are shifted and compared from the bottom\n * up; If any value pair doesn't match, the returned observable will emit `false` and complete. If one of the\n * observables completes, the operator will wait for the other observable to complete; If the other\n * observable emits before completing, the returned observable will emit `false` and complete. If one observable never\n * completes or emits after the other complets, the returned observable will never complete.\n *\n * @example <caption>figure out if the Konami code matches</caption>\n * var code = Observable.from([\n * \"ArrowUp\",\n * \"ArrowUp\",\n * \"ArrowDown\",\n * \"ArrowDown\",\n * \"ArrowLeft\",\n * \"ArrowRight\",\n * \"ArrowLeft\",\n * \"ArrowRight\",\n * \"KeyB\",\n * \"KeyA\",\n * \"Enter\" // no start key, clearly.\n * ]);\n *\n * var keys = Rx.Observable.fromEvent(document, 'keyup')\n * .map(e => e.code);\n * var matches = keys.bufferCount(11, 1)\n * .mergeMap(\n * last11 =>\n * Rx.Observable.from(last11)\n * .sequenceEqual(code)\n * );\n * matches.subscribe(matched => console.log('Successful cheat at Contra? ', matched));\n *\n * @see {@link combineLatest}\n * @see {@link zip}\n * @see {@link withLatestFrom}\n *\n * @param {Observable} compareTo the observable sequence to compare the source sequence to.\n * @param {function} [comparor] An optional function to compare each value pair\n * @return {Observable} An Observable of a single boolean value representing whether or not\n * the values emitted by both observables were equal in sequence\n * @method sequenceEqual\n * @owner Observable\n ",
"range": [
140,
2253
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 55,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "sequenceEqual",
"range": [
2270,
2283
],
"loc": {
"start": {
"line": 56,
"column": 16
},
"end": {
"line": 56,
"column": 29
}
}
},
"params": [
{
"type": "Identifier",
"name": "compareTo",
"range": [
2284,
2293
],
"loc": {
"start": {
"line": 56,
"column": 30
},
"end": {
"line": 56,
"column": 39
}
}
},
{
"type": "Identifier",
"name": "comparor",
"range": [
2295,
2303
],
"loc": {
"start": {
"line": 56,
"column": 41
},
"end": {
"line": 56,
"column": 49
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2318,
2322
],
"loc": {
"start": {
"line": 57,
"column": 11
},
"end": {
"line": 57,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"name": "lift",
"range": [
2323,
2327
],
"loc": {
"start": {
"line": 57,
"column": 16
},
"end": {
"line": 57,
"column": 20
}
}
},
"range": [
2318,
2327
],
"loc": {
"start": {
"line": 57,
"column": 11
},
"end": {
"line": 57,
"column": 20
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "SequenceEqualOperator",
"range": [
2332,
2353
],
"loc": {
"start": {
"line": 57,
"column": 25
},
"end": {
"line": 57,
"column": 46
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "compareTo",
"range": [
2354,
2363
],
"loc": {
"start": {
"line": 57,
"column": 47
},
"end": {
"line": 57,
"column": 56
}
}
},
{
"type": "Identifier",
"name": "comparor",
"range": [
2365,
2373
],
"loc": {
"start": {
"line": 57,
"column": 58
},
"end": {
"line": 57,
"column": 66
}
}
}
],
"range": [
2328,
2374
],
"loc": {
"start": {
"line": 57,
"column": 21
},
"end": {
"line": 57,
"column": 67
}
}
}
],
"range": [
2318,
2375
],
"loc": {
"start": {
"line": 57,
"column": 11
},
"end": {
"line": 57,
"column": 68
}
}
},
"range": [
2311,
2376
],
"loc": {
"start": {
"line": 57,
"column": 4
},
"end": {
"line": 57,
"column": 69
}
}
}
],
"range": [
2305,
2378
],
"loc": {
"start": {
"line": 56,
"column": 51
},
"end": {
"line": 58,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
2261,
2378
],
"loc": {
"start": {
"line": 56,
"column": 7
},
"end": {
"line": 58,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Compares all values of two observables in sequence using an optional comparor function\n * and returns an observable of a single boolean value representing whether or not the two sequences\n * are equal.\n *\n * <span class=\"informal\">Checks to see of all values emitted by both observables are equal, in order.</span>\n *\n * <img src=\"./img/sequenceEqual.png\" width=\"100%\">\n *\n * `sequenceEqual` subscribes to two observables and buffers incoming values from each observable. Whenever either\n * observable emits a value, the value is buffered and the buffers are shifted and compared from the bottom\n * up; If any value pair doesn't match, the returned observable will emit `false` and complete. If one of the\n * observables completes, the operator will wait for the other observable to complete; If the other\n * observable emits before completing, the returned observable will emit `false` and complete. If one observable never\n * completes or emits after the other complets, the returned observable will never complete.\n *\n * @example <caption>figure out if the Konami code matches</caption>\n * var code = Observable.from([\n * \"ArrowUp\",\n * \"ArrowUp\",\n * \"ArrowDown\",\n * \"ArrowDown\",\n * \"ArrowLeft\",\n * \"ArrowRight\",\n * \"ArrowLeft\",\n * \"ArrowRight\",\n * \"KeyB\",\n * \"KeyA\",\n * \"Enter\" // no start key, clearly.\n * ]);\n *\n * var keys = Rx.Observable.fromEvent(document, 'keyup')\n * .map(e => e.code);\n * var matches = keys.bufferCount(11, 1)\n * .mergeMap(\n * last11 =>\n * Rx.Observable.from(last11)\n * .sequenceEqual(code)\n * );\n * matches.subscribe(matched => console.log('Successful cheat at Contra? ', matched));\n *\n * @see {@link combineLatest}\n * @see {@link zip}\n * @see {@link withLatestFrom}\n *\n * @param {Observable} compareTo the observable sequence to compare the source sequence to.\n * @param {function} [comparor] An optional function to compare each value pair\n * @return {Observable} An Observable of a single boolean value representing whether or not\n * the values emitted by both observables were equal in sequence\n * @method sequenceEqual\n * @owner Observable\n ",
"range": [
140,
2253
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 55,
"column": 3
}
}
}
],
"trailingComments": []
},
"specifiers": [],
"source": null,
"range": [
2254,
2378
],
"loc": {
"start": {
"line": 56,
"column": 0
},
"end": {
"line": 58,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Compares all values of two observables in sequence using an optional comparor function\n * and returns an observable of a single boolean value representing whether or not the two sequences\n * are equal.\n *\n * <span class=\"informal\">Checks to see of all values emitted by both observables are equal, in order.</span>\n *\n * <img src=\"./img/sequenceEqual.png\" width=\"100%\">\n *\n * `sequenceEqual` subscribes to two observables and buffers incoming values from each observable. Whenever either\n * observable emits a value, the value is buffered and the buffers are shifted and compared from the bottom\n * up; If any value pair doesn't match, the returned observable will emit `false` and complete. If one of the\n * observables completes, the operator will wait for the other observable to complete; If the other\n * observable emits before completing, the returned observable will emit `false` and complete. If one observable never\n * completes or emits after the other complets, the returned observable will never complete.\n *\n * @example <caption>figure out if the Konami code matches</caption>\n * var code = Observable.from([\n * \"ArrowUp\",\n * \"ArrowUp\",\n * \"ArrowDown\",\n * \"ArrowDown\",\n * \"ArrowLeft\",\n * \"ArrowRight\",\n * \"ArrowLeft\",\n * \"ArrowRight\",\n * \"KeyB\",\n * \"KeyA\",\n * \"Enter\" // no start key, clearly.\n * ]);\n *\n * var keys = Rx.Observable.fromEvent(document, 'keyup')\n * .map(e => e.code);\n * var matches = keys.bufferCount(11, 1)\n * .mergeMap(\n * last11 =>\n * Rx.Observable.from(last11)\n * .sequenceEqual(code)\n * );\n * matches.subscribe(matched => console.log('Successful cheat at Contra? ', matched));\n *\n * @see {@link combineLatest}\n * @see {@link zip}\n * @see {@link withLatestFrom}\n *\n * @param {Observable} compareTo the observable sequence to compare the source sequence to.\n * @param {function} [comparor] An optional function to compare each value pair\n * @return {Observable} An Observable of a single boolean value representing whether or not\n * the values emitted by both observables were equal in sequence\n * @method sequenceEqual\n * @owner Observable\n ",
"range": [
140,
2253
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 55,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "SequenceEqualOperator",
"range": [
2390,
2411
],
"loc": {
"start": {
"line": 59,
"column": 11
},
"end": {
"line": 59,
"column": 32
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "SequenceEqualOperator",
"range": [
2442,
2463
],
"loc": {
"start": {
"line": 60,
"column": 13
},
"end": {
"line": 60,
"column": 34
}
}
},
"params": [
{
"type": "Identifier",
"name": "compareTo",
"range": [
2464,
2473
],
"loc": {
"start": {
"line": 60,
"column": 35
},
"end": {
"line": 60,
"column": 44
}
}
},
{
"type": "Identifier",
"name": "comparor",
"range": [
2475,
2483
],
"loc": {
"start": {
"line": 60,
"column": 46
},
"end": {
"line": 60,
"column": 54
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2495,
2499
],
"loc": {
"start": {
"line": 61,
"column": 8
},
"end": {
"line": 61,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "compareTo",
"range": [
2500,
2509
],
"loc": {
"start": {
"line": 61,
"column": 13
},
"end": {
"line": 61,
"column": 22
}
}
},
"range": [
2495,
2509
],
"loc": {
"start": {
"line": 61,
"column": 8
},
"end": {
"line": 61,
"column": 22
}
}
},
"right": {
"type": "Identifier",
"name": "compareTo",
"range": [
2512,
2521
],
"loc": {
"start": {
"line": 61,
"column": 25
},
"end": {
"line": 61,
"column": 34
}
}
},
"range": [
2495,
2521
],
"loc": {
"start": {
"line": 61,
"column": 8
},
"end": {
"line": 61,
"column": 34
}
}
},
"range": [
2495,
2522
],
"loc": {
"start": {
"line": 61,
"column": 8
},
"end": {
"line": 61,
"column": 35
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2531,
2535
],
"loc": {
"start": {
"line": 62,
"column": 8
},
"end": {
"line": 62,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "comparor",
"range": [
2536,
2544
],
"loc": {
"start": {
"line": 62,
"column": 13
},
"end": {
"line": 62,
"column": 21
}
}
},
"range": [
2531,
2544
],
"loc": {
"start": {
"line": 62,
"column": 8
},
"end": {
"line": 62,
"column": 21
}
}
},
"right": {
"type": "Identifier",
"name": "comparor",
"range": [
2547,
2555
],
"loc": {
"start": {
"line": 62,
"column": 24
},
"end": {
"line": 62,
"column": 32
}
}
},
"range": [
2531,
2555
],
"loc": {
"start": {
"line": 62,
"column": 8
},
"end": {
"line": 62,
"column": 32
}
}
},
"range": [
2531,
2556
],
"loc": {
"start": {
"line": 62,
"column": 8
},
"end": {
"line": 62,
"column": 33
}
}
}
],
"range": [
2485,
2562
],
"loc": {
"start": {
"line": 60,
"column": 56
},
"end": {
"line": 63,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
2433,
2562
],
"loc": {
"start": {
"line": 60,
"column": 4
},
"end": {
"line": 63,
"column": 5
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "SequenceEqualOperator",
"range": [
2567,
2588
],
"loc": {
"start": {
"line": 64,
"column": 4
},
"end": {
"line": 64,
"column": 25
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
2589,
2598
],
"loc": {
"start": {
"line": 64,
"column": 26
},
"end": {
"line": 64,
"column": 35
}
}
},
"range": [
2567,
2598
],
"loc": {
"start": {
"line": 64,
"column": 4
},
"end": {
"line": 64,
"column": 35
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
2599,
2603
],
"loc": {
"start": {
"line": 64,
"column": 36
},
"end": {
"line": 64,
"column": 40
}
}
},
"range": [
2567,
2603
],
"loc": {
"start": {
"line": 64,
"column": 4
},
"end": {
"line": 64,
"column": 40
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2616,
2626
],
"loc": {
"start": {
"line": 64,
"column": 53
},
"end": {
"line": 64,
"column": 63
}
}
},
{
"type": "Identifier",
"name": "source",
"range": [
2628,
2634
],
"loc": {
"start": {
"line": 64,
"column": 65
},
"end": {
"line": 64,
"column": 71
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "source",
"range": [
2653,
2659
],
"loc": {
"start": {
"line": 65,
"column": 15
},
"end": {
"line": 65,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"name": "_subscribe",
"range": [
2660,
2670
],
"loc": {
"start": {
"line": 65,
"column": 22
},
"end": {
"line": 65,
"column": 32
}
}
},
"range": [
2653,
2670
],
"loc": {
"start": {
"line": 65,
"column": 15
},
"end": {
"line": 65,
"column": 32
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "SequenceEqualSubscriber",
"range": [
2675,
2698
],
"loc": {
"start": {
"line": 65,
"column": 37
},
"end": {
"line": 65,
"column": 60
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2699,
2709
],
"loc": {
"start": {
"line": 65,
"column": 61
},
"end": {
"line": 65,
"column": 71
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2711,
2715
],
"loc": {
"start": {
"line": 65,
"column": 73
},
"end": {
"line": 65,
"column": 77
}
}
},
"property": {
"type": "Identifier",
"name": "compareTo",
"range": [
2716,
2725
],
"loc": {
"start": {
"line": 65,
"column": 78
},
"end": {
"line": 65,
"column": 87
}
}
},
"range": [
2711,
2725
],
"loc": {
"start": {
"line": 65,
"column": 73
},
"end": {
"line": 65,
"column": 87
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2727,
2731
],
"loc": {
"start": {
"line": 65,
"column": 89
},
"end": {
"line": 65,
"column": 93
}
}
},
"property": {
"type": "Identifier",
"name": "comparor",
"range": [
2732,
2740
],
"loc": {
"start": {
"line": 65,
"column": 94
},
"end": {
"line": 65,
"column": 102
}
}
},
"range": [
2727,
2740
],
"loc": {
"start": {
"line": 65,
"column": 89
},
"end": {
"line": 65,
"column": 102
}
}
}
],
"range": [
2671,
2741
],
"loc": {
"start": {
"line": 6