UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,559 lines (1,558 loc) 73.7 kB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "map", "range": [ 9, 12 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 12 } } }, "imported": { "type": "Identifier", "name": "map", "range": [ 9, 12 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 12 } } }, "range": [ 9, 12 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 12 } } } ], "source": { "type": "Literal", "value": "./map", "raw": "'./map'", "range": [ 20, 27 ], "loc": { "start": { "line": 1, "column": 20 }, "end": { "line": 1, "column": 27 } } }, "range": [ 0, 28 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 28 } }, "trailingComments": [ { "type": "Block", "value": "*\n * Maps each source value (an object) to its specified nested property.\n *\n * <span class=\"informal\">Like {@link map}, but meant only for picking one of\n * the nested properties of every emitted object.</span>\n *\n * <img src=\"./img/pluck.png\" width=\"100%\">\n *\n * Given a list of strings describing a path to an object property, retrieves\n * the value of a specified nested property from all values in the source\n * Observable. If a property can't be resolved, it will return `undefined` for\n * that value.\n *\n * @example <caption>Map every every click to the tagName of the clicked target element</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var tagNames = clicks.pluck('target', 'tagName');\n * tagNames.subscribe(x => console.log(x));\n *\n * @see {@link map}\n *\n * @param {...string} properties The nested properties to pluck from each source\n * value (an object).\n * @return {Observable} Returns a new Observable of property values from the\n * source values.\n * @method pluck\n * @owner Observable\n ", "range": [ 29, 1062 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 28, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "pluck", "range": [ 1079, 1084 ], "loc": { "start": { "line": 29, "column": 16 }, "end": { "line": 29, "column": 21 } } }, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "properties", "range": [ 1097, 1107 ], "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 18 } } }, "init": { "type": "ArrayExpression", "elements": [], "range": [ 1110, 1112 ], "loc": { "start": { "line": 30, "column": 21 }, "end": { "line": 30, "column": 23 } } }, "range": [ 1097, 1112 ], "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 23 } } } ], "kind": "var", "range": [ 1093, 1113 ], "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 24 } } }, { "type": "ForStatement", "init": { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "_i", "range": [ 1127, 1129 ], "loc": { "start": { "line": 31, "column": 13 }, "end": { "line": 31, "column": 15 } } }, "init": { "type": "Literal", "value": 0, "raw": "0", "range": [ 1132, 1133 ], "loc": { "start": { "line": 31, "column": 18 }, "end": { "line": 31, "column": 19 } } }, "range": [ 1127, 1133 ], "loc": { "start": { "line": 31, "column": 13 }, "end": { "line": 31, "column": 19 } } } ], "kind": "var", "range": [ 1123, 1133 ], "loc": { "start": { "line": 31, "column": 9 }, "end": { "line": 31, "column": 19 } } }, "test": { "type": "BinaryExpression", "operator": "<", "left": { "type": "Identifier", "name": "_i", "range": [ 1135, 1137 ], "loc": { "start": { "line": 31, "column": 21 }, "end": { "line": 31, "column": 23 } } }, "right": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "arguments", "range": [ 1140, 1149 ], "loc": { "start": { "line": 31, "column": 26 }, "end": { "line": 31, "column": 35 } } }, "property": { "type": "Identifier", "name": "length", "range": [ 1150, 1156 ], "loc": { "start": { "line": 31, "column": 36 }, "end": { "line": 31, "column": 42 } } }, "range": [ 1140, 1156 ], "loc": { "start": { "line": 31, "column": 26 }, "end": { "line": 31, "column": 42 } } }, "range": [ 1135, 1156 ], "loc": { "start": { "line": 31, "column": 21 }, "end": { "line": 31, "column": 42 } } }, "update": { "type": "UpdateExpression", "operator": "++", "argument": { "type": "Identifier", "name": "_i", "range": [ 1158, 1160 ], "loc": { "start": { "line": 31, "column": 44 }, "end": { "line": 31, "column": 46 } } }, "prefix": false, "range": [ 1158, 1162 ], "loc": { "start": { "line": 31, "column": 44 }, "end": { "line": 31, "column": 48 } } }, "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": true, "object": { "type": "Identifier", "name": "properties", "range": [ 1174, 1184 ], "loc": { "start": { "line": 32, "column": 8 }, "end": { "line": 32, "column": 18 } } }, "property": { "type": "BinaryExpression", "operator": "-", "left": { "type": "Identifier", "name": "_i", "range": [ 1185, 1187 ], "loc": { "start": { "line": 32, "column": 19 }, "end": { "line": 32, "column": 21 } } }, "right": { "type": "Literal", "value": 0, "raw": "0", "range": [ 1190, 1191 ], "loc": { "start": { "line": 32, "column": 24 }, "end": { "line": 32, "column": 25 } } }, "range": [ 1185, 1191 ], "loc": { "start": { "line": 32, "column": 19 }, "end": { "line": 32, "column": 25 } } }, "range": [ 1174, 1192 ], "loc": { "start": { "line": 32, "column": 8 }, "end": { "line": 32, "column": 26 } } }, "right": { "type": "MemberExpression", "computed": true, "object": { "type": "Identifier", "name": "arguments", "range": [ 1195, 1204 ], "loc": { "start": { "line": 32, "column": 29 }, "end": { "line": 32, "column": 38 } } }, "property": { "type": "Identifier", "name": "_i", "range": [ 1205, 1207 ], "loc": { "start": { "line": 32, "column": 39 }, "end": { "line": 32, "column": 41 } } }, "range": [ 1195, 1208 ], "loc": { "start": { "line": 32, "column": 29 }, "end": { "line": 32, "column": 42 } } }, "range": [ 1174, 1208 ], "loc": { "start": { "line": 32, "column": 8 }, "end": { "line": 32, "column": 42 } } }, "range": [ 1174, 1209 ], "loc": { "start": { "line": 32, "column": 8 }, "end": { "line": 32, "column": 43 } } } ], "range": [ 1164, 1215 ], "loc": { "start": { "line": 31, "column": 50 }, "end": { "line": 33, "column": 5 } } }, "range": [ 1118, 1215 ], "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 33, "column": 5 } } }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "length", "range": [ 1224, 1230 ], "loc": { "start": { "line": 34, "column": 8 }, "end": { "line": 34, "column": 14 } } }, "init": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "properties", "range": [ 1233, 1243 ], "loc": { "start": { "line": 34, "column": 17 }, "end": { "line": 34, "column": 27 } } }, "property": { "type": "Identifier", "name": "length", "range": [ 1244, 1250 ], "loc": { "start": { "line": 34, "column": 28 }, "end": { "line": 34, "column": 34 } } }, "range": [ 1233, 1250 ], "loc": { "start": { "line": 34, "column": 17 }, "end": { "line": 34, "column": 34 } } }, "range": [ 1224, 1250 ], "loc": { "start": { "line": 34, "column": 8 }, "end": { "line": 34, "column": 34 } } } ], "kind": "var", "range": [ 1220, 1251 ], "loc": { "start": { "line": 34, "column": 4 }, "end": { "line": 34, "column": 35 } } }, { "type": "IfStatement", "test": { "type": "BinaryExpression", "operator": "===", "left": { "type": "Identifier", "name": "length", "range": [ 1260, 1266 ], "loc": { "start": { "line": 35, "column": 8 }, "end": { "line": 35, "column": 14 } } }, "right": { "type": "Literal", "value": 0, "raw": "0", "range": [ 1271, 1272 ], "loc": { "start": { "line": 35, "column": 19 }, "end": { "line": 35, "column": 20 } } }, "range": [ 1260, 1272 ], "loc": { "start": { "line": 35, "column": 8 }, "end": { "line": 35, "column": 20 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "ThrowStatement", "argument": { "type": "NewExpression", "callee": { "type": "Identifier", "name": "Error", "range": [ 1294, 1299 ], "loc": { "start": { "line": 36, "column": 18 }, "end": { "line": 36, "column": 23 } } }, "arguments": [ { "type": "Literal", "value": "list of properties cannot be empty.", "raw": "'list of properties cannot be empty.'", "range": [ 1300, 1337 ], "loc": { "start": { "line": 36, "column": 24 }, "end": { "line": 36, "column": 61 } } } ], "range": [ 1290, 1338 ], "loc": { "start": { "line": 36, "column": 14 }, "end": { "line": 36, "column": 62 } } }, "range": [ 1284, 1339 ], "loc": { "start": { "line": 36, "column": 8 }, "end": { "line": 36, "column": 63 } } } ], "range": [ 1274, 1345 ], "loc": { "start": { "line": 35, "column": 22 }, "end": { "line": 37, "column": 5 } } }, "alternate": null, "range": [ 1256, 1345 ], "loc": { "start": { "line": 35, "column": 4 }, "end": { "line": 37, "column": 5 } } }, { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "map", "range": [ 1357, 1360 ], "loc": { "start": { "line": 38, "column": 11 }, "end": { "line": 38, "column": 14 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 1361, 1365 ], "loc": { "start": { "line": 38, "column": 15 }, "end": { "line": 38, "column": 19 } } }, "range": [ 1357, 1365 ], "loc": { "start": { "line": 38, "column": 11 }, "end": { "line": 38, "column": 19 } } }, "arguments": [ { "type": "ThisExpression", "range": [ 1366, 1370 ], "loc": { "start": { "line": 38, "column": 20 }, "end": { "line": 38, "column": 24 } } }, { "type": "CallExpression", "callee": { "type": "Identifier", "name": "plucker", "range": [ 1372, 1379 ], "loc": { "start": { "line": 38, "column": 26 }, "end": { "line": 38, "column": 33 } } }, "arguments": [ { "type": "Identifier", "name": "properties", "range": [ 1380, 1390 ], "loc": { "start": { "line": 38, "column": 34 }, "end": { "line": 38, "column": 44 } } }, { "type": "Identifier", "name": "length", "range": [ 1392, 1398 ], "loc": { "start": { "line": 38, "column": 46 }, "end": { "line": 38, "column": 52 } } } ], "range": [ 1372, 1399 ], "loc": { "start": { "line": 38, "column": 26 }, "end": { "line": 38, "column": 53 } } } ], "range": [ 1357, 1400 ], "loc": { "start": { "line": 38, "column": 11 }, "end": { "line": 38, "column": 54 } } }, "range": [ 1350, 1401 ], "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 38, "column": 55 } } } ], "range": [ 1087, 1403 ], "loc": { "start": { "line": 29, "column": 24 }, "end": { "line": 39, "column": 1 } } }, "generator": false, "expression": false, "range": [ 1070, 1403 ], "loc": { "start": { "line": 29, "column": 7 }, "end": { "line": 39, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Maps each source value (an object) to its specified nested property.\n *\n * <span class=\"informal\">Like {@link map}, but meant only for picking one of\n * the nested properties of every emitted object.</span>\n *\n * <img src=\"./img/pluck.png\" width=\"100%\">\n *\n * Given a list of strings describing a path to an object property, retrieves\n * the value of a specified nested property from all values in the source\n * Observable. If a property can't be resolved, it will return `undefined` for\n * that value.\n *\n * @example <caption>Map every every click to the tagName of the clicked target element</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var tagNames = clicks.pluck('target', 'tagName');\n * tagNames.subscribe(x => console.log(x));\n *\n * @see {@link map}\n *\n * @param {...string} properties The nested properties to pluck from each source\n * value (an object).\n * @return {Observable} Returns a new Observable of property values from the\n * source values.\n * @method pluck\n * @owner Observable\n ", "range": [ 29, 1062 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 28, "column": 3 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 1063, 1403 ], "loc": { "start": { "line": 29, "column": 0 }, "end": { "line": 39, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Maps each source value (an object) to its specified nested property.\n *\n * <span class=\"informal\">Like {@link map}, but meant only for picking one of\n * the nested properties of every emitted object.</span>\n *\n * <img src=\"./img/pluck.png\" width=\"100%\">\n *\n * Given a list of strings describing a path to an object property, retrieves\n * the value of a specified nested property from all values in the source\n * Observable. If a property can't be resolved, it will return `undefined` for\n * that value.\n *\n * @example <caption>Map every every click to the tagName of the clicked target element</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var tagNames = clicks.pluck('target', 'tagName');\n * tagNames.subscribe(x => console.log(x));\n *\n * @see {@link map}\n *\n * @param {...string} properties The nested properties to pluck from each source\n * value (an object).\n * @return {Observable} Returns a new Observable of property values from the\n * source values.\n * @method pluck\n * @owner Observable\n ", "range": [ 29, 1062 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 28, "column": 3 } } } ] }, { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "plucker", "range": [ 1413, 1420 ], "loc": { "start": { "line": 40, "column": 9 }, "end": { "line": 40, "column": 16 } } }, "params": [ { "type": "Identifier", "name": "props", "range": [ 1421, 1426 ], "loc": { "start": { "line": 40, "column": 17 }, "end": { "line": 40, "column": 22 } } }, { "type": "Identifier", "name": "length", "range": [ 1428, 1434 ], "loc": { "start": { "line": 40, "column": 24 }, "end": { "line": 40, "column": 30 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "mapper", "range": [ 1446, 1452 ], "loc": { "start": { "line": 41, "column": 8 }, "end": { "line": 41, "column": 14 } } }, "init": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "x", "range": [ 1465, 1466 ], "loc": { "start": { "line": 41, "column": 27 }, "end": { "line": 41, "column": 28 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "currentProp", "range": [ 1482, 1493 ], "loc": { "start": { "line": 42, "column": 12 }, "end": { "line": 42, "column": 23 } } }, "init": { "type": "Identifier", "name": "x", "range": [ 1496, 1497 ], "loc": { "start": { "line": 42, "column": 26 }, "end": { "line": 42, "column": 27 } } }, "range": [ 1482, 1497 ], "loc": { "start": { "line": 42, "column": 12 }, "end": { "line": 42, "column": 27 } } } ], "kind": "var", "range": [ 1478, 1498 ], "loc": { "start": { "line": 42, "column": 8 }, "end": { "line": 42, "column": 28 } } }, { "type": "ForStatement", "init": { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "i", "range": [ 1516, 1517 ], "loc": { "start": { "line": 43, "column": 17 }, "end": { "line": 43, "column": 18 } } }, "init": { "type": "Literal", "value": 0, "raw": "0", "range": [ 1520, 1521 ], "loc": { "start": { "line": 43, "column": 21 }, "end": { "line": 43, "column": 22 } } }, "range": [ 1516, 1521 ], "loc": { "start": { "line": 43, "column": 17 }, "end": { "line": 43, "column": 22 } } } ], "kind": "var", "range": [ 1512, 1521 ], "loc": { "start": { "line": 43, "column": 13 }, "end": { "line": 43, "column": 22 } } }, "test": { "type": "BinaryExpression", "operator": "<", "left": { "type": "Identifier", "name": "i", "range": [ 1523, 1524 ], "loc": { "start": { "line": 43, "column": 24 }, "end": { "line": 43, "column": 25 } } }, "right": { "type": "Identifier", "name": "length", "range": [ 1527, 1533 ], "loc": { "start": { "line": 43, "column": 28 }, "end": { "line": 43, "column": 34 } } }, "range": [ 1523, 1533 ], "loc": { "start": { "line": 43, "column": 24 }, "end": { "line": 43, "column": 34 } } }, "update": { "type": "UpdateExpression", "operator": "++", "argument": { "type": "Identifier", "name": "i", "range": [ 1535, 1536 ], "loc": { "start": { "line": 43, "column": 36 }, "end": { "line": 43, "column": 37 } } }, "prefix": false, "range": [ 1535, 1538 ], "loc": { "start": { "line": 43, "column": 36 }, "end": { "line": 43, "column": 39 } } }, "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "p", "range": [ 1558, 1559 ], "loc": { "start": { "line": 44, "column": 16 }, "end": { "line": 44, "column": 17 } } }, "init": { "type": "MemberExpression", "computed": true, "object": { "type": "Identifier", "name": "currentProp", "range": [