src/appstate.js
function transformSyncBranch (action, parentAction, path, actions, isSync) {
  var branch = {
    name: getFunctionName(action),
    args: {},
    output: null,
    duration: 0,
    mutations: [],
    isAsync: !isSync,
    outputPath: null,
    isExecuting: false,
    hasExecuted: false,
    path: path.slice(),
    outputs: null,
    actionIndex: actions.indexOf(action) === -1 ? actions.push(action) - 1 : actions.indexOf(action)
  };

  var nextAction = parentAction[parentAction.indexOf(action) + 1];
  if (!Array.isArray(nextAction) && typeof nextAction === 'object') {
    parentAction.splice(parentAction.indexOf(nextAction), 1);

    branch.outputs = Object.keys(nextAction)
      .reduce((paths, key) => {
        path = path.concat('outputs', key);
        paths[key] = transformBranch(nextAction[key], parentAction, path, actions, false);
        path.pop();
        path.pop();
        return paths;
      }, {});
  }

  return branch;
}
function transformSyncBranch (action, parentAction, path, actions, isSync) {
  var branch = {
    name: getFunctionName(action),
    args: {},
    output: null,
    duration: 0,
    mutations: [],
    isAsync: !isSync,
    outputPath: null,
    isExecuting: false,
    hasExecuted: false,
    path: path.slice(),
    outputs: null,
    actionIndex: actions.indexOf(action) === -1 ? actions.push(action) - 1 : actions.indexOf(action)
  };

  var nextAction = parentAction[parentAction.indexOf(action) + 1];
  if (!Array.isArray(nextAction) && typeof nextAction === 'object') {
    parentAction.splice(parentAction.indexOf(nextAction), 1);

    branch.outputs = Object.keys(nextAction)
      .reduce((paths, key) => {
        path = path.concat('outputs', key);
        paths[key] = transformBranch(nextAction[key], parentAction, path, actions, false);
        path.pop();
        path.pop();
        return paths;
      }, {});
  }

  return branch;
}
function transformSyncBranch ( action , parentAction , path , actions , isSync ) { var branch = { name : getFunctionName ( action ) , args : { } , output : null , duration : 0 , mutations : [ ] , isAsync : ! isSync , outputPath : null , isExecuting : false , hasExecuted : false , path : path . slice ( ) , outputs : null , actionIndex : actions . indexOf ( action ) === - 1 ? actions . push ( action ) - 1 : actions . indexOf ( action ) } ; var nextAction = parentAction [ parentAction . indexOf ( action ) + 1 ] ; if ( ! Array . isArray ( nextAction ) && typeof nextAction === 'object' ) { parentAction . splice ( parentAction . indexOf ( nextAction ) , 1 ) ; branch . outputs = Object . keys ( nextAction ) . reduce ( ( paths , key ) => { path = path . concat ( 'outputs' , key ) ; paths [ key ] = transformBranch ( nextAction [ key ] , parentAction , path , actions , false ) ; path . pop ( ) ; path . pop ( ) ; return paths ; } , { } ) ; } return branch ; }
Transform action to sync branch
@param {Function} action
@param {Array|Function} parentAction
@param {Array} path
@param {Array} actions
@param {Boolean} isSync
@returns {{
name: *, args: {}, output: null, duration: number,
mutations: Array, isAsync: boolean, outputPath: null,
isExecuting: boolean, hasExecuted: boolean,
path: *, outputs: null, actionIndex: number
}|undefined}
Transform action to sync branch