lib/valve.js
function checkChain(value, chain, baton, callback) {
  var funs = chain.validators.map(function(i) {
    return i.func;
  });

  function _reduce(memo, validator, callback) {
    validator(memo, baton, function(err, result) {
      var message;
      if (err) {
        if (err.hasOwnProperty(message)) {
          message = err.message;
        } else {
          message = err;
        }
        callback(message);
      } else {
        callback(null, result);
      }
    });
  }

  async.reduce(funs, value, _reduce, callback);
}
function checkChain(value, chain, baton, callback) {
  var funs = chain.validators.map(function(i) {
    return i.func;
  });

  function _reduce(memo, validator, callback) {
    validator(memo, baton, function(err, result) {
      var message;
      if (err) {
        if (err.hasOwnProperty(message)) {
          message = err.message;
        } else {
          message = err;
        }
        callback(message);
      } else {
        callback(null, result);
      }
    });
  }

  async.reduce(funs, value, _reduce, callback);
}
function checkChain ( value , chain , baton , callback ) { var funs = chain . validators . map ( function ( i ) { return i . func ; } ) ; function _reduce ( memo , validator , callback ) { validator ( memo , baton , function ( err , result ) { var message ; if ( err ) { if ( err . hasOwnProperty ( message ) ) { message = err . message ; } else { message = err ; } callback ( message ) ; } else { callback ( null , result ) ; } } ) ; } async . reduce ( funs , value , _reduce , callback ) ; }
Tests the specified value against the validator chain, converting the
value if applicable.

@private
@param {String|Number|Object} value The value to be tested.
@param {Chain} chain The validator chain against which the value will
be tested.
@param {Function(err, result)} callback The callback that will be invoked
with the "cleaned" (tested/converted) value.
Tests the specified value against the validator chain converting the value if applicable .