Validator for ARRAY types to enforce a minimum number of items allowed for
    the ARRAY to be valid.
357068
def validate_min_items(value, minimum, **kwargs):
    
    if len(value) < minimum:
        raise ValidationError(
            MESSAGES['min_items']['invalid'].format(
                minimum, len(value),
            ),
        )
357939
def _check_items(items):
    '''
    
    '''
    num_items = 0
    # Check that the list is iterable and finite
    try:
        num_items = len(items)
    except:
        raise TypeError("The item list ({}) is not a finite iterable (has no length)".format(items))
    # Check that the list has items
    if num_items == 0:
        raise ValueError("The item list is empty.")
62783
function isValidSize(size) {
  return isArray(size) && size.length === 2 && isInteger(size[0]) && isInteger(size[1]);
}
816009
public static <T extends Comparable<? super T>> T min(final T[] a) {
        N.checkArgNotNullOrEmpty(a, "The spcified array 'a' can not be null or empty");

        return min(a, 0, a.length);
    }
964042
function validateArray(node, schema, key) {
    if (Array.isArray(node)) {
      if (schema[SCHEMALENGTH]) {
        checkLength(node.length, schema, key);
      }
      for (var arrayI = 0; arrayI < node.length; arrayI++) {
        try {
          validateNode(node[arrayI], schema[SCHEMADATA], "");
        } catch (e) {
          throw new ValidationException(
            e.message + key + " position " + arrayI
          );
        }
      }
    } else {
      throw new ValidationException("Expected array for " + key);
    }
  }
77053
function $min(params) {
    if (Array.isArray(params) && params.every(p => typeof p === 'number')) {
        return Math.min(...params);
    }
    throw new Error('$min expects an array of number');
}
1265839
def validate_items(self, input_list):
        """"""
        output_list = []
        for item in input_list:
            valid = self.list_item_type.validate(item, self.item_name)
            output_list.append(valid)

            # this might lead to confusing error messages.  tbh, we need to
            # figure out a better way to do validation and error handling here,
            # but i'm brute forcing this a bit so that we have something
            # workable
        return output_list
681629
def validate_max_items(value, maximum, **kwargs):
    
    if len(value) > maximum:
        raise ValidationError(
            MESSAGES['max_items']['invalid'].format(
                maximum, len(value),
            ),
        )
696978
function applyAllowedRuleToArray( itemsRule, items, validItems ) {
		if ( !itemsRule )
			return false;

		// True means that all elements of array are accepted (the asterix was used for classes).
		if ( itemsRule === true )
			return true;

		for ( var i = 0, l = items.length, item; i < l; ++i ) {
			item = items[ i ];
			if ( !validItems[ item ] )
				validItems[ item ] = itemsRule( item );
		}

		return false;
	}
23264
def validate_list(self, value):
        
        if len(value) > self.max_items:
            raise ValidationError(
                u'list must not contain more than {max_items} items.'.format(max_items=self.max_items)
            )

        if all(isinstance(item, six.string_types) for item in value) is False:
            raise ValidationError(u'list must only contain strings.')

        return value
16524
def validate(self, value, attribute_filter=None, minified=False):
        

        if not self._required and value is None:
            return None
        elif self._required and value is None:
            raise exception.RequiredAttributeError()

        _validated_value = self.__class__(
            element_template=self._element_template,
            min_length=self._min_length,
            max_length=self._max_length
        )

        if not isinstance(value, (list, tuple)):
            raise TypeError(value)

        for array_element in value:

            if isinstance(self._element_template, DataCollection):
                validated_array_element = self._element_template.validate(array_element, attribute_filter, minified)
            else:
                validated_array_element = self._element_template.validate(array_element)

            _validated_value.append(validated_array_element)

        if self._min_length is not None and len(_validated_value) < self._min_length:
            raise exception.LessThanMinimumError(value, self._min_length)

        if self._max_length is not None and len(_validated_value) > self._max_length:
            raise exception.MoreThanMaximumError(value, self._max_length)

        return _validated_value
736804
public static PactDslJsonArray arrayMinLike(int minSize, int numberExamples, PactDslJsonRootValue value) {
    if (numberExamples < minSize) {
      throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d",
        numberExamples, minSize));
    }
    PactDslJsonArray parent = new PactDslJsonArray("", "", null, true);
    parent.setNumberExamples(numberExamples);
    parent.matchers.addRule("", parent.matchMin(minSize));
    parent.putObject(value);
    return parent;
  }
1035535
def each_item(*validators):
    
    def validate(value):
        for item in value:
            for validator in validators:
                error = validator(item)
                if error:
                    return error
        return None
    return validate
1303471
function nanmin( arr ) {
	if ( !Array.isArray( arr ) ) {
		throw new TypeError( 'nanmin()::invalid input argument. Must provide an array.' );
	}
	var len = arr.length,
		min = null,
		val;

	for ( var i = 0; i < len; i++ ) {
		val = arr[ i ];
		if ( typeof val !== 'number' || val !== val ) {
			continue;
		}
		if ( min === null || val < min ) {
			min = val;
		}
	}
	return min;
}
1077210
def _validate_type(self, item, name):
        """"""
        if item is None:
            # don't validate None items, since they'll be caught by the portion
            # of the validator responsible for handling `required`ness
            return

        if not isinstance(item, self.allowed_types):
            item_class_name = item.__class__.__name__
            raise ArgumentError(name,
                "Expected one of %s, but got `%s`" % (
                    self.allowed_types, item_class_name))
1312751
def validate_LESSTHANEQ(value, restriction):
    
    #Sometimes restriction values can accidentally be put in the template <item>100</items>,
    #Making them a list, not a number. Rather than blowing up, just get value 1 from the list.
    if type(restriction) is list:
        restriction = restriction[0]

    value = _get_val(value)
    if type(value) is list:
        for subval in value:
            if type(subval) is tuple:
                subval = subval[1]
            validate_LESSTHANEQ(subval, restriction)
    else:
        try:
            if value > restriction:
                raise ValidationError("LESSTHANEQ: %s" % (restriction))
        except TypeError:
            # Incompatible types for comparison.
            raise ValidationError("LESSTHANEQ: Incompatible types %s"%(restriction))
1027094
def _validate_list(self, target):
        """"""
        # Check list length restrictions
        min_items = self._field.field_definition.get('minItems')
        max_items = self._field.field_definition.get('maxItems')

        if min_items is not None:
            if len(target) < min_items:
                raise ValidationError(
                    self._record,
                    "Field '{}' must have a minimum of {} item(s)".format(self._field.name, min_items)
                )

        if max_items is not None:
            if len(target) > max_items:
                raise ValidationError(
                    self._record,
                    "Field '{}' can only have a maximum of {} item(s)".format(self._field.name, max_items)
                )

        # Individual item validation
        for item in target:
            self._validate_item(item)