Returns the value for a field, but if the field doesn't exist will return default instead
498932
def get_if_present(self, name, default=None):
        
        if not self.processed_data:
            raise exceptions.FormNotProcessed('The form data has not been processed yet')

        if name in self.field_dict:
            return self[name]

        return default
1130008
function (item, field) {
            var path = field.split("."), value = item;
            while (path.length && typeof(value) !== "undefined") {
                value = value[path.shift()];
            }
            return value;
        }
75564
function defaultGetDefaultFieldNames(type) {
  // If this type cannot access fields, then return an empty set.
  if (!type.getFields) {
    return [];
  }

  const fields = type.getFields();

  // Is there an `id` field?
  if (fields['id']) {
    return ['id'];
  }

  // Is there an `edges` field?
  if (fields['edges']) {
    return ['edges'];
  }

  // Is there an `node` field?
  if (fields['node']) {
    return ['node'];
  }

  // Include all leaf-type fields.
  const leafFieldNames = [];
  Object.keys(fields).forEach(fieldName => {
    if (isLeafType(fields[fieldName].type)) {
      leafFieldNames.push(fieldName);
    }
  });
  return leafFieldNames;
}
507606
def _wrap_field(field):
    """"""
    class WrappedField(field):
        def output(self, key, obj):
            value = _fields.get_value(key if self.attribute is None else self.attribute, obj)

            # For all fields, when its value was null (None), return null directly,
            #  instead of return its default value (eg. int type's default value was 0)
            # Because sometimes the client **needs** to know, was a field of the model empty, to decide its behavior.
            return None if value is None else self.format(value)
    return WrappedField
770713
def check_field_exists(self, field_name):
        
        if not settings.DEBUG:
            return

        try:
            self.lookup_opts.get_field(field_name)

        except FieldDoesNotExist as e:
            raise AdmirarchyConfigurationError(e)
823212
def get(self, field_name, default=None):
        """"""
        checkFieldName(field_name)
        return self.data.get(field_name, default)
350900
def value_or_default(self, value):
        '''  '''
        if value is None:
            if callable(self.default):
                return self.default()
            else:
                return self.default

        return value
994316
public String getValue(final String field)
    {
        FieldValue fieldValue = Iterables.find
        (
            fieldValues,
            new Predicate<FieldValue>()
            {
                @Override
                public boolean apply(FieldValue fv)
                {
                    return fv.getField().equals(field);
                }
            },
            null
        );
        return (fieldValue != null) ? fieldValue.getValue() : null;
    }
518436
public String getField(String name, String defaultVal) {
		int index = getFieldIndex(name);
		return (isInRange(index) ? this.fields.get(index) : defaultVal);
	}
340873
def _get_field(instance, field):
    
    
    value = getattr(instance, field)
    if hasattr(value, 'raw'):
        value = value.raw
    return value
470193
def default_fields_for(value, operator = nil)

      column_types  = [:virtual]
      column_types += [:string, :text]                if [nil, :like, :unlike, :ne, :eq].include?(operator)
      column_types += [:double, :float, :decimal]     if value =~ NUMERICAL_REGXP
      column_types += [:integer]                      if value =~ INTEGER_REGXP
      column_types += [:uuid]                         if value =~ UUID_REGXP
      column_types += [:datetime, :date, :timestamp]  if (parse_temporal(value))

      default_fields.select { |field| !field.set? && column_types.include?(field.type) }
    end
135347
function(field, def) {
        var ret;
        if (field in this.__dirtyValues__) {
            ret = this.__dirtyValues__[field];
        } else if (field in this.__values__) {
            ret = this.__values__[field];
        } else if (CRUD.EntityManager.entities[this.getType()].fields.indexOf(field) > -1) {
            ret = (field in CRUD.EntityManager.entities[this.getType()].defaultValues) ? CRUD.EntityManager.entities[this.getType()].defaultValues[field] : null;
        } else {
            CRUD.log('Could not find field \'' + field + '\' in \'' + this.getType() + '\' (for get)');
        }
        return ret;
    }
1247590
def get_field(field):
    """"""
    if isinstance(field, djmodels.fields.Field):
        return field
    elif isinstance(field, basestring):
        field = field.split('.')
        if len(field) == 3:
            model = get_model(app=field[0], model=field[1])
        elif len(field) == 2:
            model = get_model(app=DEFAULT_APP, model=field[0])
        else:
            return None
            raise NotImplementedError("Unknown default model name. Don't know where to look for field %s" % '.'.join(field)) 
        field = model._meta.get_field(field[-1])
    return field
681297
def value(self, x):
        
        return x if isinstance(x, FiniteField.Value) and x.field == self else FiniteField.Value(self, x)
1014987
private String getField(int key, String undef) {
    String value = fields[key];
    return value == null ? undef : value;
  }
234161
def default_value_getter(field):
    

    def default_value_func_getter(self):
        localized_field = utils.build_localized_field_name(
            field, self._linguist.active_language
        )
        value = getattr(self, localized_field)
        if value:
            return value

        default_field = utils.build_localized_field_name(field, self.default_language)
        return getattr(self, default_field)

    return default_value_func_getter
224245
function getError(field, value) {
	// Check we actually got a string
	if (typeof value !== "string") {
		return errorInvalidParams(field + " must be a string");
	}
	// Check value is not empty
	if (!value.trim()) {
		return errorInvalidParams(field + " must not be empty");
	}
}