Max validator Validates that the value has to be a number and equal to or less than the max value specified
516531
function(value, attr, maxValue, model) {
        if (!isNumber(value) || value > maxValue) {
          return this.format(getMessageKey(this.msgKey, defaultMessages.max), this.formatLabel(attr, model), maxValue);
        }
      }
1000318
function checkNum(nums, min, max){
  if(nums == null)
    return false;

  if(nums == -1)
    return true;

  for(let i = 0; i < nums.length; i++){
    if(nums[i]<min || nums[i]>max)
      return false;
  }

  return true;
}
1295288
function (value, min, max) {
        value = parseInt(value, 10);
        min = min | 0;
        if (isNaN(value) || value < min) {
            return false;
        }
        if (max && value > max) {
            return false;
        }
        return true;
    }
1208061
protected function _validator_maxlength($input, $value, $max) {
		if (!is_string($value)) return false;
		if (strlen($value) > $max) return false;
		return true;
	}
478840
public static Integer validateInteger(final String context,
			final String input, final int minValue, final int maxValue,
			final boolean allowNull) throws ValidationException {
		return validator.getValidInteger(context, input, minValue, maxValue,
				allowNull);
	}
683950
def check_errors
      if @value && @value.is_a?(Numeric)
        if @args.is_a?(Hash)

          @args.each do |arg, val|
            case arg
            when :min
              add_error("number must be greater than #{val}") if @value < val
            when :max
              add_error("number must be less than #{val}") if @value > val
            end
          end

        end
      else
        message = (@args.is_a?(Hash) && @args[:message]) || 'must be a number'
        add_error(message)
      end
    end
836001
function() { 
      
      var v = this.getValue(), str_value = inputEx.NumberField.superclass.getValue.call(this);
      
      // empty field
      if (v === '') {
         // validate only if not required
         return !this.options.required;
      }
      
      if (isNaN(v)) {
         return false;
      }
      
      // We have to check the number with a regexp, otherwise "0.03a" is parsed to a valid number 0.03
      return !!str_value.match(/^([\+\-]?((([0-9]+(\.)?)|([0-9]*\.[0-9]+))([eE][+-]?[0-9]+)?))$/) && v >= this.options.min && v <= this.options.max;
      
   }
58643
def _validate_max(self, proposal):
        """"""
        max = proposal['value']
        if max < self.min:
            raise TraitError('setting max < min')
        if max < self.value:
            self.value = max
        return max
1110664
public static function isRequiredNumberRange($value, $min, $max)
    {
        return (is_int($value) || is_float($value)) && $min <= $value && $max >= $value;
    }
280291
protected void validateDouble(String field, double min, double max, String errorKey, String errorMessage) {
		String value = controller.getPara(field);
		if (StrKit.isBlank(value)) {
			addError(errorKey, errorMessage);
			return ;
		}
		try {
			double temp = Double.parseDouble(value.trim());
			if (temp < min || temp > max) {
				addError(errorKey, errorMessage);
			}
		}
		catch (Exception e) {
			addError(errorKey, errorMessage);
		}
	}
37962
function check_value(val, min, max) {
    val = +val;
    if (typeof(val) != 'number' || val < min || val > max || Math.floor(val) !== val) {
        throw new TypeError("\"value\" argument is out of bounds");
    }
    return val;
}
740220
def valid_max_age(number):
    ""
    if isinstance(number, basestring):
        try:
            number = long(number)
        except (ValueError, TypeError):
            return False
    if number >= 0 and number % 1 == 0:
        return True
    return False
1285639
def is_numeric(property_name, *, numtype="float", min=None, max=None,
                 present_optional=False, message=None):
    """"""
    if numtype == "int":
      cast = util.try_parse_int
    elif numtype == "decimal":
      cast = util.try_parse_decimal
    elif numtype == "float":
      cast = util.try_parse_float
    else:
      raise ValueError("numtype argument must be one of: int, decimal, float")

    def check(val):
      """Checks that a value can be parsed as a number."""
      if val is None:
        return present_optional
      else:
        is_num, new_val = cast(val)
        if not is_num:
          return False
        else:
          if min is not None and new_val < min:
            return False
          if max is not None and new_val > max:
            return False
          return True

    if not message:
      msg = ["must be a"]
      if numtype == "int":
        msg.append("whole number")
      else:
        msg.append("number")
      if min is not None and max is not None:
        msg.append("between {0} and {1}".format(min, max))
      elif min is not None:
        msg.append("greater than or equal to {0}".format(min))
      elif max is not None:
        msg.append("less than or equal to {0}".format(max))
      message = " ".join(msg)

    return Validation(check, property_name, message)
140634
def length(min=None, max=None):
    

    def validate(value):
        if min and len(value) < min:
            return e("{} does not have a length of at least {}", value, min)
        if max and len(value) > max:
            return e("{} does not have a length of at most {}", value, max)
    return validate
1373994
def between(min_value, max_value):
    
    def validate(value):
        if value < min_value:
            return e("{} is not greater than or equal to {}",
                value, min_value)
        if value > max_value:
            return e("{} is not less than or equal to {}",
                value, max_value)
    return validate
787489
def validate_wrap(self, value):
        '''  '''
        if not isinstance(value, basestring):
            self._fail_validation_type(value, basestring)
        if self.max is not None and len(value) > self.max:
            self._fail_validation(value, 'Value too long (%d)' % len(value))
        if self.min is not None and len(value) < self.min:
            self._fail_validation(value, 'Value too short (%d)' % len(value))
909177
public static function isOptionalNumericRange($value, $min, $max)
    {
        /* No additional validations when the value is null. */
        if (null === $value) {

            return true;
        }

        return self::isRequiredNumericRange($value, $min, $max);
    }