lib/defaultCommandHandler.js
function (aggregate, cmd, callback) {
    if (!aggregate || !_.isObject(aggregate)) {
      var err = new Error('Please pass a valid aggregate!');
      debug(err);
      throw err;
    }
    if (!cmd || !_.isObject(cmd)) {
      var err = new Error('Please pass a valid command!');
      debug(err);
      throw err;
    }
    if (!callback || !_.isFunction(callback)) {
      var err = new Error('Please pass a valid function!');
      debug(err);
      throw err;
    }

    this.aggregate.handle(aggregate, cmd, callback);
  }
function (aggregate, cmd, callback) {
    if (!aggregate || !_.isObject(aggregate)) {
      var err = new Error('Please pass a valid aggregate!');
      debug(err);
      throw err;
    }
    if (!cmd || !_.isObject(cmd)) {
      var err = new Error('Please pass a valid command!');
      debug(err);
      throw err;
    }
    if (!callback || !_.isFunction(callback)) {
      var err = new Error('Please pass a valid function!');
      debug(err);
      throw err;
    }

    this.aggregate.handle(aggregate, cmd, callback);
  }
function ( aggregate , cmd , callback ) { if ( ! aggregate || ! _ . isObject ( aggregate ) ) { var err = new Error ( 'Please pass a valid aggregate!' ) ; debug ( err ) ; throw err ; } if ( ! cmd || ! _ . isObject ( cmd ) ) { var err = new Error ( 'Please pass a valid command!' ) ; debug ( err ) ; throw err ; } if ( ! callback || ! _ . isFunction ( callback ) ) { var err = new Error ( 'Please pass a valid function!' ) ; debug ( err ) ; throw err ; } this . aggregate . handle ( aggregate , cmd , callback ) ; }
Handles the command by passing it to the handle function of the aggregate.
@param {AggregateModel} aggregate The passed aggregate.
@param {Object}         cmd       The command.
@param {Function}       callback  The function, that will be called when this action is completed.
`function(err){}`
Handles the command by passing it to the handle function of the aggregate .