lib/utils.js
/**
 * Wraps an object map of action functions in new functions that automatically call dispatch()
 * @param  {Object} dispatcher Instance of the Dispatcher
 * @param  {Object} actions    Map of action functions
 * @return {Object}            Map of wrapped action functions
 */
Wraps an object map of action functions in new functions that automatically call dispatch()
@param  {Object} dispatcher Instance of the Dispatcher
@param  {Object} actions    Map of action functions
@return {Object}            Map of wrapped action functions
Wraps an object map of action functions in new functions that automatically call dispatch () @param { Object } dispatcher Instance of the Dispatcher @param { Object } actions Map of action functions @return { Object } Map of wrapped action functions
function wrapActionProps(dispatcher, actions) {
  var wrappedActionProps = {};
  var actionFunc;
  for (var actionName in actions) {
    actionFunc = actions[actionName];
    wrappedActionProps[actionName] = function(actionFunc) {
      var args = Array.prototype.slice.call(arguments, 1);
      dispatcher.dispatch(actionFunc.apply(actions, args));
    }.bind(this, actionFunc); 
  }
  return wrappedActionProps;
}
function wrapActionProps ( dispatcher , actions ) { var wrappedActionProps = { } ; var actionFunc ; for ( var actionName in actions ) { actionFunc = actions [ actionName ] ; wrappedActionProps [ actionName ] = function ( actionFunc ) { var args = Array . prototype . slice . call ( arguments , 1 ) ; dispatcher . dispatch ( actionFunc . apply ( actions , args ) ) ; } . bind ( this , actionFunc ) ; } return wrappedActionProps ; }
Wraps an object map of action functions in new functions that automatically call dispatch()
 @param  {Object} dispatcher Instance of the Dispatcher
 @param  {Object} actions    Map of action functions
 @return {Object}            Map of wrapped action functions
Wraps an object map of action functions in new functions that automatically call dispatch () @param { Object } dispatcher Instance of the Dispatcher @param { Object } actions Map of action functions @return { Object } Map of wrapped action functions
// Wrap each action function and automatically call dispatch() with the result of the action // Use bind to capture the value of actionFunc in a closure