src/appstate.js
function analyze (actions) {
  if (!Array.isArray(actions)) {
    throw new Error('State: Signal actions should be array');
  }

  actions.forEach((action, index) => {
    if (typeof action === 'undefined' || typeof action === 'string') {
      throw new Error(
        `
            State: Action number "${index}" in signal does not exist.
            Check that you have spelled it correctly!
          `
      );
    }

    if (Array.isArray(action)) {
      analyze(action);
    } else if (Object.prototype.toString.call(action) === "[object Object]") {
      Object.keys(action).forEach(function (output) {
        analyze(action[output]);
      });
    }
  });
}
function analyze (actions) {
  if (!Array.isArray(actions)) {
    throw new Error('State: Signal actions should be array');
  }

  actions.forEach((action, index) => {
    if (typeof action === 'undefined' || typeof action === 'string') {
      throw new Error(
        `
            State: Action number "${index}" in signal does not exist.
            Check that you have spelled it correctly!
          `
      );
    }

    if (Array.isArray(action)) {
      analyze(action);
    } else if (Object.prototype.toString.call(action) === "[object Object]") {
      Object.keys(action).forEach(function (output) {
        analyze(action[output]);
      });
    }
  });
}
function analyze ( actions ) { if ( ! Array . isArray ( actions ) ) { throw new Error ( 'State: Signal actions should be array' ) ; } actions . forEach ( ( action , index ) => { if ( typeof action === 'undefined' || typeof action === 'string' ) { throw new Error ( ` ${ index } ` ) ; } if ( Array . isArray ( action ) ) { analyze ( action ) ; } else if ( Object . prototype . toString . call ( action ) === "[object Object]" ) { Object . keys ( action ) . forEach ( function ( output ) { analyze ( action [ output ] ) ; } ) ; } } ) ; }
Analyze actions for errors
@param {Array} actions
Analyze actions for errors