whole_func_string: function validate(ctrl, validatorName, validity, value){
    ctrl.$setValidity(validatorName, validity);
    return validity ? value : undefined;
  }
func_code_string: function validate(ctrl, validatorName, validity, value){
    ctrl.$setValidity(validatorName, validity);
    return validity ? value : undefined;
  }
func_documentation_string: A helper function to call $setValidity and return the value / undefined, a pattern that is repeated a lot in the input validation logic.