src/core/valdr-service.js
function (typeName, fieldName, value) {

              var validResult = { valid: true },
                typeConstraints = constraintsForType(typeName);

              if (valdrUtil.has(typeConstraints, fieldName)) {
                var fieldConstraints = typeConstraints[fieldName],
                  fieldIsValid = true,
                  validationResults = [],
                  violations = [];

                angular.forEach(fieldConstraints, function (constraint, validatorName) {
                  var validator = validators[validatorName];

                  if (angular.isUndefined(validator)) {
                    $log.warn('No validator defined for \'' + validatorName +
                      '\'. Can not validate field \'' + fieldName + '\'');
                    return validResult;
                  }

                  var valid = validator.validate(value, constraint);
                  var validationResult = {
                    valid: valid,
                    value: value,
                    field: fieldName,
                    type: typeName,
                    validator: validatorName
                  };
                  angular.extend(validationResult, constraint);

                  validationResults.push(validationResult);
                  if (!valid) {
                    violations.push(validationResult);
                  }
                  fieldIsValid = fieldIsValid && valid;
                });

                return {
                  valid: fieldIsValid,
                  violations: violations.length === 0 ? undefined : violations,
                  validationResults: validationResults.length === 0 ? undefined : validationResults
                };
              } else {
                return validResult;
              }
            }
function (typeName, fieldName, value) {

              var validResult = { valid: true },
                typeConstraints = constraintsForType(typeName);

              if (valdrUtil.has(typeConstraints, fieldName)) {
                var fieldConstraints = typeConstraints[fieldName],
                  fieldIsValid = true,
                  validationResults = [],
                  violations = [];

                angular.forEach(fieldConstraints, function (constraint, validatorName) {
                  var validator = validators[validatorName];

                  if (angular.isUndefined(validator)) {
                    $log.warn('No validator defined for \'' + validatorName +
                      '\'. Can not validate field \'' + fieldName + '\'');
                    return validResult;
                  }

                  var valid = validator.validate(value, constraint);
                  var validationResult = {
                    valid: valid,
                    value: value,
                    field: fieldName,
                    type: typeName,
                    validator: validatorName
                  };
                  angular.extend(validationResult, constraint);

                  validationResults.push(validationResult);
                  if (!valid) {
                    violations.push(validationResult);
                  }
                  fieldIsValid = fieldIsValid && valid;
                });

                return {
                  valid: fieldIsValid,
                  violations: violations.length === 0 ? undefined : violations,
                  validationResults: validationResults.length === 0 ? undefined : validationResults
                };
              } else {
                return validResult;
              }
            }
function ( typeName , fieldName , value ) { var validResult = { valid : true } , typeConstraints = constraintsForType ( typeName ) ; if ( valdrUtil . has ( typeConstraints , fieldName ) ) { var fieldConstraints = typeConstraints [ fieldName ] , fieldIsValid = true , validationResults = [ ] , violations = [ ] ; angular . forEach ( fieldConstraints , function ( constraint , validatorName ) { var validator = validators [ validatorName ] ; if ( angular . isUndefined ( validator ) ) { $log . warn ( 'No validator defined for \'' + validatorName + '\'. Can not validate field \'' + fieldName + '\'' ) ; return validResult ; } var valid = validator . validate ( value , constraint ) ; var validationResult = { valid : valid , value : value , field : fieldName , type : typeName , validator : validatorName } ; angular . extend ( validationResult , constraint ) ; validationResults . push ( validationResult ) ; if ( ! valid ) { violations . push ( validationResult ) ; } fieldIsValid = fieldIsValid && valid ; } ) ; return { valid : fieldIsValid , violations : violations . length === 0 ? undefined : violations , validationResults : validationResults . length === 0 ? undefined : validationResults } ; } else { return validResult ; } }
Validates the value of the given type with the constraints for the given field name.

@param typeName the type name
@param fieldName the field name
@param value the value to validate
@returns {*}
Validates the value of the given type with the constraints for the given field name .