UNPKG

@xailabs/altx

Version:

Flux flavor based on alt.js

1,081 lines (1,080 loc) 207 kB
{ "type": "File", "start": 0, "end": 1391, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 34, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1391, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 34, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 30, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 30 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 14, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 14 } }, "local": { "type": "Identifier", "start": 7, "end": 14, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 14 }, "identifierName": "Promise" }, "name": "Promise" } } ], "source": { "type": "StringLiteral", "start": 20, "end": 29, "loc": { "start": { "line": 1, "column": 20 }, "end": { "line": 1, "column": 29 } }, "extra": { "rawValue": "promise", "raw": "'promise'" }, "value": "promise" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Retuns a promise and executes a series of calls.\r\n * Uses a timeout initially so that we don't run into errors when still in the middle of a dispatch.\r\n *\r\n * import {callSeries} from 'shared/flux';\r\n *\r\n * @param {array} calls - An array of function that each returns a promise\r\n * @param {object} options - An array of function that each returns a promise\r\n * @param {boolean} options.log - Whether to log individual calls\r\n * @return {promise} - A promise that will be resolved when all calls succeeded or rejected if one call failed\r\n ", "start": 32, "end": 582, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 12, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 584, "end": 1389, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 33, "column": 1 } }, "declaration": { "type": "FunctionDeclaration", "start": 599, "end": 1389, "loc": { "start": { "line": 13, "column": 15 }, "end": { "line": 33, "column": 1 } }, "id": { "type": "Identifier", "start": 608, "end": 618, "loc": { "start": { "line": 13, "column": 24 }, "end": { "line": 13, "column": 34 }, "identifierName": "callSeries" }, "name": "callSeries", "leadingComments": null }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 619, "end": 624, "loc": { "start": { "line": 13, "column": 35 }, "end": { "line": 13, "column": 40 }, "identifierName": "calls" }, "name": "calls" }, { "type": "AssignmentPattern", "start": 626, "end": 645, "loc": { "start": { "line": 13, "column": 42 }, "end": { "line": 13, "column": 61 } }, "left": { "type": "ObjectPattern", "start": 626, "end": 639, "loc": { "start": { "line": 13, "column": 42 }, "end": { "line": 13, "column": 55 } }, "properties": [ { "type": "ObjectProperty", "start": 627, "end": 638, "loc": { "start": { "line": 13, "column": 43 }, "end": { "line": 13, "column": 54 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 627, "end": 630, "loc": { "start": { "line": 13, "column": 43 }, "end": { "line": 13, "column": 46 }, "identifierName": "log" }, "name": "log" }, "value": { "type": "AssignmentPattern", "start": 627, "end": 638, "loc": { "start": { "line": 13, "column": 43 }, "end": { "line": 13, "column": 54 } }, "left": { "type": "Identifier", "start": 627, "end": 630, "loc": { "start": { "line": 13, "column": 43 }, "end": { "line": 13, "column": 46 }, "identifierName": "log" }, "name": "log" }, "right": { "type": "BooleanLiteral", "start": 633, "end": 638, "loc": { "start": { "line": 13, "column": 49 }, "end": { "line": 13, "column": 54 } }, "value": false } }, "extra": { "shorthand": true } } ] }, "right": { "type": "ObjectExpression", "start": 643, "end": 645, "loc": { "start": { "line": 13, "column": 59 }, "end": { "line": 13, "column": 61 } }, "properties": [] } } ], "body": { "type": "BlockStatement", "start": 647, "end": 1389, "loc": { "start": { "line": 13, "column": 63 }, "end": { "line": 33, "column": 1 } }, "body": [ { "type": "ReturnStatement", "start": 654, "end": 1386, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 32, "column": 7 } }, "argument": { "type": "NewExpression", "start": 661, "end": 1385, "loc": { "start": { "line": 14, "column": 11 }, "end": { "line": 32, "column": 6 } }, "callee": { "type": "Identifier", "start": 665, "end": 672, "loc": { "start": { "line": 14, "column": 15 }, "end": { "line": 14, "column": 22 }, "identifierName": "Promise" }, "name": "Promise" }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 673, "end": 1384, "loc": { "start": { "line": 14, "column": 23 }, "end": { "line": 32, "column": 5 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 674, "end": 681, "loc": { "start": { "line": 14, "column": 24 }, "end": { "line": 14, "column": 31 }, "identifierName": "resolve" }, "name": "resolve" }, { "type": "Identifier", "start": 683, "end": 689, "loc": { "start": { "line": 14, "column": 33 }, "end": { "line": 14, "column": 39 }, "identifierName": "reject" }, "name": "reject" } ], "body": { "type": "BlockStatement", "start": 694, "end": 1384, "loc": { "start": { "line": 14, "column": 44 }, "end": { "line": 32, "column": 5 } }, "body": [ { "type": "VariableDeclaration", "start": 705, "end": 722, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 25 } }, "declarations": [ { "type": "VariableDeclarator", "start": 709, "end": 721, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 24 } }, "id": { "type": "Identifier", "start": 709, "end": 716, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 19 }, "identifierName": "results" }, "name": "results" }, "init": { "type": "ArrayExpression", "start": 719, "end": 721, "loc": { "start": { "line": 15, "column": 22 }, "end": { "line": 15, "column": 24 } }, "elements": [] } } ], "kind": "let" }, { "type": "ExpressionStatement", "start": 732, "end": 1377, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 31, "column": 11 } }, "expression": { "type": "CallExpression", "start": 732, "end": 1376, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 31, "column": 10 } }, "callee": { "type": "Identifier", "start": 732, "end": 742, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 18 }, "identifierName": "setTimeout" }, "name": "setTimeout" }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 743, "end": 1375, "loc": { "start": { "line": 16, "column": 19 }, "end": { "line": 31, "column": 9 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 749, "end": 1375, "loc": { "start": { "line": 16, "column": 25 }, "end": { "line": 31, "column": 9 } }, "body": [ { "type": "FunctionDeclaration", "start": 764, "end": 1225, "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 27, "column": 13 } }, "id": { "type": "Identifier", "start": 773, "end": 779, "loc": { "start": { "line": 17, "column": 21 }, "end": { "line": 17, "column": 27 }, "identifierName": "series" }, "name": "series" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 780, "end": 784, "loc": { "start": { "line": 17, "column": 28 }, "end": { "line": 17, "column": 32 }, "identifierName": "list" }, "name": "list" } ], "body": { "type": "BlockStatement", "start": 786, "end": 1225, "loc": { "start": { "line": 17, "column": 34 }, "end": { "line": 27, "column": 13 } }, "body": [ { "type": "ExpressionStatement", "start": 805, "end": 851, "loc": { "start": { "line": 18, "column": 16 }, "end": { "line": 18, "column": 62 } }, "expression": { "type": "LogicalExpression", "start": 805, "end": 850, "loc": { "start": { "line": 18, "column": 16 }, "end": { "line": 18, "column": 61 } }, "left": { "type": "Identifier", "start": 805, "end": 808, "loc": { "start": { "line": 18, "column": 16 }, "end": { "line": 18, "column": 19 }, "identifierName": "log" }, "name": "log" }, "operator": "&&", "right": { "type": "CallExpression", "start": 812, "end": 850, "loc": { "start": { "line": 18, "column": 23 }, "end": { "line": 18, "column": 61 } }, "callee": { "type": "MemberExpression", "start": 812, "end": 823, "loc": { "start": { "line": 18, "column": 23 }, "end": { "line": 18, "column": 34 } }, "object": { "type": "Identifier", "start": 812, "end": 819, "loc": { "start": { "line": 18, "column": 23 }, "end": { "line": 18, "column": 30 }, "identifierName": "console" }, "name": "console" }, "property": { "type": "Identifier", "start": 820, "end": 823, "loc": { "start": { "line": 18, "column": 31 }, "end": { "line": 18, "column": 34 }, "identifierName": "log" }, "name": "log" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 824, "end": 843, "loc": { "start": { "line": 18, "column": 35 }, "end": { "line": 18, "column": 54 } }, "extra": { "rawValue": "[callSeries] list", "raw": "'[callSeries] list'" }, "value": "[callSeries] list" }, { "type": "Identifier", "start": 845, "end": 849, "loc": { "start": { "line": 18, "column": 56 }, "end": { "line": 18, "column": 60 }, "identifierName": "list" }, "name": "list" } ] } } }, { "type": "VariableDeclaration", "start": 869, "end": 895, "loc": { "start": { "line": 19, "column": 16 }, "end": { "line": 19, "column": 42 } }, "declarations": [ { "type": "VariableDeclarator", "start": 873, "end": 894, "loc": { "start": { "line": 19, "column": 20 }, "end": { "line": 19, "column": 41 } }, "id": { "type": "Identifier", "start": 873, "end": 874, "loc": { "start": { "line": 19, "column": 20 }, "end": { "line": 19, "column": 21 }, "identifierName": "p" }, "name": "p" }, "init": { "type": "CallExpression", "start": 877, "end": 894, "loc": { "start": { "line": 19, "column": 24 }, "end": { "line": 19, "column": 41 } }, "callee": { "type": "MemberExpression", "start": 877, "end": 892, "loc": { "start": { "line": 19, "column": 24 }, "end": { "line": 19, "column": 39 } }, "object": { "type": "Identifier", "start": 877, "end": 884, "loc": { "start": { "line": 19, "column": 24 }, "end": { "line": 19, "column": 31 }, "identifierName": "Promise" }, "name": "Promise" }, "property": { "type": "Identifier", "start": 885, "end": 892, "loc": { "start": { "line": 19, "column": 32 }, "end": { "line": 19, "column": 39 }, "identifierName": "resolve" }, "name": "resolve" }, "computed": false }, "arguments": [] } } ], "kind": "var" }, { "type": "ReturnStatement", "start": 913, "end": 1210, "loc": { "start": { "line": 20, "column": 16 }, "end": { "line": 26, "column": 22 } }, "argument": { "type": "CallExpression", "start": 920, "end": 1209, "loc": { "start": { "line": 20, "column": 23 }, "end": { "line": 26, "column": 21 } }, "callee": { "type": "MemberExpression", "start": 920, "end": 931, "loc": { "start": { "line": 20, "column": 23 }, "end": { "line": 20, "column": 34 } }, "object": { "type": "Identifier", "start": 920, "end": 924, "loc": { "start": { "line": 20, "column": 23 }, "end": { "line": 20, "column": 27 }, "identifierName": "list" }, "name": "list" }, "property": { "type": "Identifier", "start": 925, "end": 931, "loc": { "start": { "line": 20, "column": 28 }, "end": { "line": 20, "column": 34 }, "identifierName": "reduce" }, "name": "reduce" }, "computed": false }, "arguments": [ { "type": "FunctionExpression", "start": 932, "end": 1205, "loc": { "start": { "line": 20, "column": 35 }, "end": { "line": 26, "column": 17 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 941, "end": 945, "loc": { "start": { "line": 20, "column": 44 }, "end": { "line": 20, "column": 48 }, "identifierName": "pacc" }, "name": "pacc" }, { "type": "Identifier", "start": 947, "end": 949, "loc": { "start": { "line": 20, "column": 50 }, "end": { "line": 20, "column": 52 }, "identifierName": "fn" }, "name": "fn" } ], "body": { "type": "BlockStatement", "start": 951, "end": 1205, "loc": { "start": { "line": 20, "column": 54 }, "end": { "line": 26, "column": 17 } }, "body": [ {