This validator checks the given field`s value is not null.
@class Definition
@method validatesPresenceOf
@param {array} fields - The fields to validate

@return {Definition}
329406
function() {
    var args = this.store.utils.args(arguments)
    if (args.length > 1) {
      return this.validateFieldsHelper(args, this.validatesPresenceOf)
    }

    var field = args[0]

    if (Array.isArray(field)) {
      return this.validateFieldsHelper(field, [], this.validatesPresenceOf)
    }

    return this.validates(field, function() {
      var valid = this[field] != null
      if (!valid) this.errors.add(field, 'should be present')
      return valid
    })
  }
919024
function validationPlugin(Schema) {
    var constructor = Schema.prototype.constructor;

    Schema.prototype.constructor = function (name, schema) {
        var key;
        var fieldDefinition;

        if (arguments.length === 1) {
            schema = arguments[0];
        }

        // call super constructor
        constructor.apply(this, arguments);

        this.validators = {};

        for (key in schema) {
            if (schema.hasOwnProperty(key)) {
                fieldDefinition = schema[key];
                this.validators[key] = [];

                // predefined validators
                if (fieldDefinition.required) {
                    this.validators[key].push(defaultValidators.required());
                }
                if (value(fieldDefinition.enum).typeOf(Array)) {
                    this.validators[key].push(defaultValidators.enum(fieldDefinition.enum));
                }

                if (value(fieldDefinition.min).typeOf(Number)) {
                    this.validators[key].push(defaultValidators.min(fieldDefinition.min));
                }

                if (value(fieldDefinition.max).typeOf(Number)) {
                    this.validators[key].push(defaultValidators.max(fieldDefinition.max));
                }

                if (value(fieldDefinition.minLength).typeOf(Number)) {
                    this.validators[key].push(defaultValidators.minLength(fieldDefinition.minLength));
                }

                if (value(fieldDefinition.maxLength).typeOf(Number)) {
                    this.validators[key].push(defaultValidators.maxLength(fieldDefinition.maxLength));
                }

                if (value(fieldDefinition.hasLength).typeOf(Number)) {
                    this.validators[key].push(defaultValidators.hasLength(fieldDefinition.hasLength));
                }

                // The matches validators works on all types, so we just check if the key is present
                if ("matches" in fieldDefinition) {
                    this.validators[key].push(defaultValidators.matches(fieldDefinition.matches));
                }

                // custom validators
                if (value(fieldDefinition.validate).typeOf(Function)) {
                    this.validators[key].push(fieldDefinition.validate);
                } else if (value(fieldDefinition.validate).typeOf(Array)) {
                    this.validators[key] = this.validators[key].concat(fieldDefinition.validate);
                }
            }
        }
    };

    /**
     * Validate if given model matches schema definition. Returns a promise with the validation result object
     * which contains the intermediate result of all synchronous validators.
     *
     * @param {Object} model
     * @param {Function=} callback
     * @returns {Promise}
     */
    Schema.prototype.validate = function (model, callback) {
        var self = this;
        var pending = 0;
        var result = {
            model: model,
            result: true,
            errors: {}
        };
        var promise;

        function handleFieldErrors(key, fieldErrors) {
            if (fieldErrors.length > 0) {
                result.result = false;
                result.errors[key] = fieldErrors;
            }
        }

        function doCallback() {
            callback(result);
        }

        if (value(model).notTypeOf(Object)) {
            throw new TypeError("Model must be an object");
        }

        if (!this.validators) {
            throw new Error("Validators not defined: Have you registered the validate plugin before any schema definitions?");
        }

        promise = new Promise(function (resolve) {
            function done() {
                if (typeof callback === "function") {
                    setTimeout(doCallback, 0);
                }
                resolve(result);
            }

            if (self.fields.length === 0) {
                done();
                return;
            }

            pending = self.fields.length;

            self.fields.forEach(function (key) {
                var fieldErrors = runValidation(self.validators[key], model[key], model, function onFieldValidation(fieldErrors) {
                    pending--;
                    handleFieldErrors(key, fieldErrors);

                    if (pending === 0) {
                        done();
                    }
                });

                handleFieldErrors(key, fieldErrors);
            });
        });
        // Attach intermediate result to promise
        promise.validation = result;

        return promise;
    };
}
522971
function addValidator(fieldValidator, fieldName, field) {
    fieldValidator[fieldName] = dispatcher.validate(field.type.key);
    if (typeof field.defaultValue !== 'undefined') {
      fieldValidator[fieldName].default(field.defaultValue);
    }
    if (field.type.values) {
      fieldValidator[fieldName].options(field.type.values);
    }
    fieldValidator[fieldName].fieldName = fieldName;
    return fieldValidator[fieldName];
  }
380835
public Match exclude(String... fields) {
    if(fields != null) {
      excludes.addAll(Arrays.asList(fields));
    }
    return this;
  }
373989
function(fields, data) {
    if (!_.isString(fields)) {
      return data;
    }

    // If a field is specified as `foo.bar` or `foo.bar.baz`,
    // Convert it to just `foo`
    var map = {};
    _.forEach(fields.split(','), function(field) {
      map[field.split('.')[0]] = 1;
    });

    var keys = _.keys(map);
    if (_.isArray(data)) {
      data = _.map(data, function(object) {
        return _.pick(object, keys);
      });
    } else if (_.isObject(data)) {
      data = _.pick(data, keys);
    }

    return data;
  }
475226
def validateField(cls, fieldName, value) :
        
        try :
            valValue = Collection.validateField(fieldName, value)
        except SchemaViolation as e:
            if fieldName == "_from" or fieldName == "_to" :
                return True
            else :
                raise e
        return valValue
1247969
final public static function validatePresence (array $requiredFields=[], string $option=NULL) : bool
	{
		$option 			= static::checkGlobal($option);
		$fieldsWithError 	= "";
		foreach ($requiredFields as $field):
			if (!isset($option[$field]) || !static::hasValue($option[$field])) 
				$fieldsWithError .= "'".fieldNameAsText($field)."', ";
		endforeach;
		static::setError($fieldsWithError);
		return static::checkError();
	}
927183
public function validateAsRequiredFields(array $fields) {
		foreach ($fields as $v) {
			$options = $this->fields[$v];
			$options['options']['required'] = true;
			$this->validateRequiredOneField($this->values[$v], $v, $options);
		}
	}
779162
function(field, fieldName, showErrors) {
            showErrors = (showErrors !== undefined)
              ? showErrors
              : true
            ;
            if(typeof field == 'string') {
              module.verbose('Validating field', field);
              fieldName = field;
              field     = validation[field];
            }
            var
              identifier    = field.identifier || fieldName,
              $field        = module.get.field(identifier),
              $dependsField = (field.depends)
                ? module.get.field(field.depends)
                : false,
              fieldValid  = true,
              fieldErrors = []
            ;
            if(!field.identifier) {
              module.debug('Using field name as identifier', identifier);
              field.identifier = identifier;
            }
            if($field.prop('disabled')) {
              module.debug('Field is disabled. Skipping', identifier);
              fieldValid = true;
            }
            else if(field.optional && module.is.blank($field)){
              module.debug('Field is optional and blank. Skipping', identifier);
              fieldValid = true;
            }
            else if(field.depends && module.is.empty($dependsField)) {
              module.debug('Field depends on another value that is not present or empty. Skipping', $dependsField);
              fieldValid = true;
            }
            else if(field.rules !== undefined) {
              $.each(field.rules, function(index, rule) {
                if( module.has.field(identifier) && !( module.validate.rule(field, rule) ) ) {
                  module.debug('Field is invalid', identifier, rule.type);
                  fieldErrors.push(module.get.prompt(rule, field));
                  fieldValid = false;
                }
              });
            }
            if(fieldValid) {
              if(showErrors) {
                module.remove.prompt(identifier, fieldErrors);
                settings.onValid.call($field);
              }
            }
            else {
              if(showErrors) {
                formErrors = formErrors.concat(fieldErrors);
                module.add.prompt(identifier, fieldErrors);
                settings.onInvalid.call($field, fieldErrors);
              }
              return false;
            }
            return true;
          }
843169
function validateFieldType(fieldsCollection){
        var err;

        // ensure fieldsCollection is an array.
        if(!_.isArray(fieldsCollection)) {
            err = new Error('content type fields collection must be an array of field objects.');
        }

        if(!err) {
            _.each(fieldsCollection, function(field){
                err = isValidField(field);
            });
        }

        return _.isUndefined(err);
    }
359316
function(field, length) {
    if (Array.isArray(field)) {
      return this.validateFieldsHelper(field, [length], this.validatesLengthOf)
    }

    return this.validates(field, function() {
      var valid = true
      if (this[field]) valid = this[field].length <= length
      if (!valid)
        this.errors.add(field, 'maximum length of ' + length + ' exceeded')
      return valid
    })
  }
323320
def validate_field(field, params)
      begin
        value = params.fetch(field)
        required_error(field) if value.nil? || value.empty?
      rescue KeyError
        required_error(field)
      end
    end
759984
function (value, node) {
        var i, el;
        var valid = (typeof value === "object");
        var fields = {};
        if (valid) {
            /*  pass 1: ensure that all mandatory fields exist
                and determine map of valid fields for pass 2  */
            for (i = 0; i < node.elements.length; i++) {
                el = node.elements[i];
                fields[el.key] = el.element;
                if (   el.arity[0] > 0
                    && (   (el.key === "@" && _cs.keysof(value).length === 0)
                        || (el.key !== "@" && typeof value[el.key] === "undefined"))) {
                    valid = false;
                    break;
                }
            }
        }
        if (valid) {
            /*  pass 2: ensure that no unknown fields exist
                and that all existing fields are valid  */
            for (var field in value) {
                if (   !Object.hasOwnProperty.call(value, field)
                    || !Object.propertyIsEnumerable.call(value, field)
                    || field === "constructor"
                    || field === "prototype"                          )
                    continue;
                if (   typeof fields[field] !== "undefined"
                    && this.exec_spec(value[field], fields[field])) /*  RECURSION  */
                    continue;
                if (   typeof fields["@"] !== "undefined"
                    && this.exec_spec(value[field], fields["@"]))   /*  RECURSION  */
                    continue;
                valid = false;
                break;
            }
        }
        return valid;
    }
346553
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case QUALIFIERS:
      return isSetQualifiers();
    }
    throw new IllegalStateException();
  }
121533
function hasField(selection, fieldNames) {
  if (!selection || selection.type === 'empty') {
    return false;
  }
  const fieldsToLookup = [].concat(fieldNames);

  if (selection.type === 'range') {
    const fields = Object.keys(selection.range.variables);
    const match = intersect(fieldsToLookup, fields);
    return match.length > 0;
  }
  if (selection.type === 'partition') {
    return fieldsToLookup.indexOf(selection.partition.variable) !== -1;
  }

  console.log(
    'SelectionBuilder::hasField does not handle selection of type',
    selection.type
  );

  return false;
}
595360
function setFieldErrors (error) {
    // skip if no error object
    if (!error) {
        return
    }
    // if error is string then add as generic error
    if (typeof error === 'string') {
        this.errors.push(error)
    }
    // if error is object then should be error object from AJV
    else if (typeof error === 'object') {
        // validation errors are set as array on error data - it this is not
        // set then only add generic error
        if (!Array.isArray(error.data)) {
            // create message
            var message = typeof error.message === 'string'
                ? error.message
                : 'An error occurred'
            // add message to errors
            this.errors.push(message)
            // skip further processing
            return
        }
        // add validation errors to fields and clear values for fields with errors
        _.each(error.data, error => this.setFieldError(error))
    }
}
578779
function(fields) {
      var columndefs = [];
    	for(var i = 0 ; i < fields.length ; i++) {
    		columndefs.push( this.fieldToColumndef(fields[i]) );
    	}
    	return columndefs;
   }