validate.js
function(attributes, constraints, options) {
      options = v.extend({}, v.async.options, options);

      var WrapErrors = options.wrapErrors || function(errors) {
        return errors;
      };

      // Removes unknown attributes
      if (options.cleanAttributes !== false) {
        attributes = v.cleanAttributes(attributes, constraints);
      }

      var results = v.runValidations(attributes, constraints, options);

      return new v.Promise(function(resolve, reject) {
        v.waitForResults(results).then(function() {
          var errors = v.processValidationResults(results, options);
          if (errors) {
            reject(new WrapErrors(errors, options, attributes, constraints));
          } else {
            resolve(attributes);
          }
        }, function(err) {
          reject(err);
        });
      });
    }
function(attributes, constraints, options) {
      options = v.extend({}, v.async.options, options);

      var WrapErrors = options.wrapErrors || function(errors) {
        return errors;
      };

      // Removes unknown attributes
      if (options.cleanAttributes !== false) {
        attributes = v.cleanAttributes(attributes, constraints);
      }

      var results = v.runValidations(attributes, constraints, options);

      return new v.Promise(function(resolve, reject) {
        v.waitForResults(results).then(function() {
          var errors = v.processValidationResults(results, options);
          if (errors) {
            reject(new WrapErrors(errors, options, attributes, constraints));
          } else {
            resolve(attributes);
          }
        }, function(err) {
          reject(err);
        });
      });
    }
function ( attributes , constraints , options ) { options = v . extend ( { } , v . async . options , options ) ; var WrapErrors = options . wrapErrors || function ( errors ) { return errors ; } ; // Removes unknown attributes if ( options . cleanAttributes !== false ) { attributes = v . cleanAttributes ( attributes , constraints ) ; } var results = v . runValidations ( attributes , constraints , options ) ; return new v . Promise ( function ( resolve , reject ) { v . waitForResults ( results ) . then ( function ( ) { var errors = v . processValidationResults ( results , options ) ; if ( errors ) { reject ( new WrapErrors ( errors , options , attributes , constraints ) ) ; } else { resolve ( attributes ) ; } } , function ( err ) { reject ( err ) ; } ) ; } ) ; }
Runs the validations with support for promises. This function will return a promise that is settled when all the validation promises have been completed. It can be called even if no validations returned a promise.
Runs the validations with support for promises . This function will return a promise that is settled when all the validation promises have been completed . It can be called even if no validations returned a promise .