lib/definitions/aggregate.js
function (cmd, callback) {
    var cmdName = dotty.get(cmd, this.definitions.command.name);

    var err;
    if (!cmdName) {
      err = new Error('command has no command name in ' + this.definitions.command.name);
      debug(err);
      return callback(err);
    }

    var version = 0;
    if (!!this.definitions.command.version) {
      version = dotty.get(cmd, this.definitions.command.version);
    }

    var command = this.getCommand(cmdName, version);
    if (!command) {
      err = new Error('Command "' + cmdName + '" not found!');
      debug(err);
      return callback(err);
    }

    if (command.validate.length >= 2) {
      return command.validate(cmd, callback);
    }

    try {
      callback(command.validate(cmd));
    } catch (e) {
      callback(e);
    }
  }
function (cmd, callback) {
    var cmdName = dotty.get(cmd, this.definitions.command.name);

    var err;
    if (!cmdName) {
      err = new Error('command has no command name in ' + this.definitions.command.name);
      debug(err);
      return callback(err);
    }

    var version = 0;
    if (!!this.definitions.command.version) {
      version = dotty.get(cmd, this.definitions.command.version);
    }

    var command = this.getCommand(cmdName, version);
    if (!command) {
      err = new Error('Command "' + cmdName + '" not found!');
      debug(err);
      return callback(err);
    }

    if (command.validate.length >= 2) {
      return command.validate(cmd, callback);
    }

    try {
      callback(command.validate(cmd));
    } catch (e) {
      callback(e);
    }
  }
function ( cmd , callback ) { var cmdName = dotty . get ( cmd , this . definitions . command . name ) ; var err ; if ( ! cmdName ) { err = new Error ( 'command has no command name in ' + this . definitions . command . name ) ; debug ( err ) ; return callback ( err ) ; } var version = 0 ; if ( ! ! this . definitions . command . version ) { version = dotty . get ( cmd , this . definitions . command . version ) ; } var command = this . getCommand ( cmdName , version ) ; if ( ! command ) { err = new Error ( 'Command "' + cmdName + '" not found!' ) ; debug ( err ) ; return callback ( err ) ; } if ( command . validate . length >= 2 ) { return command . validate ( cmd , callback ) ; } try { callback ( command . validate ( cmd ) ) ; } catch ( e ) { callback ( e ) ; } }
Validates the requested command.
@param {Object} cmd The command object
@returns {ValidationError}
Validates the requested command .