This function sanitize the user given field and return a common Array structure field
list
@param  {DataModel} dataModel the dataModel operating on
@param  {Array} fieldArr  user input of field Array
@return {Array}           arrays of field name
812
function getFieldArr (dataModel, fieldArr) {
    const retArr = [];
    const fieldStore = dataModel.getFieldspace();
    const dimensions = fieldStore.getDimension();

    Object.entries(dimensions).forEach(([key]) => {
        if (fieldArr && fieldArr.length) {
            if (fieldArr.indexOf(key) !== -1) {
                retArr.push(key);
            }
        } else {
            retArr.push(key);
        }
    });

    return retArr;
}
333307
function() {

    var params = Object.assign({},this)

    if( params.value === 'text' ) {
      params.value = void 0
      delete params.value
    }

    var data = [ this._field, params, this.value || 'text' ]

    switch( this._field ) {
      default: data.push( this._data ); break
      case 'adr':
      case 'n':
        data.push( this._data.split( ';' ) )
    }

    return data

  }
1264870
def fields(filter=nil)
      unless filter
        # Since we're returning the FieldMap object, which the caller
        # may mutate, we precautionarily mark dirty -- unless it's frozen
        # immutable.
        @fields.clean = false unless @fields.frozen?
        return @fields
      end
      @fields.reindex unless @fields.clean
      flds = []
      if filter.is_a?(String) && @fields.tags[filter]
        @fields.tags[filter].each do |idx|
          flds << @fields[idx]
        end
      elsif filter.is_a?(Array) || filter.is_a?(Range)
        @fields.each_by_tag(filter) do |tag|
          flds << tag
        end
      end
      flds
    end
962138
public static  List<FieldVector> toArrowColumnsStringSingle(final BufferAllocator bufferAllocator, final Schema schema, List<String> dataVecRecord) {
        return toArrowColumnsString(bufferAllocator,schema, Arrays.asList(dataVecRecord));
    }
318514
function sanitize (data) {
  if (
    !isPrimitive(data) &&
    !Array.isArray(data) &&
    !isPlainObject(data)
  ) {
    // handle types that will probably cause issues in
    // the structured clone
    return Object.prototype.toString.call(data)
  } else {
    return data
  }
}
400746
function setFieldValue (data, field, isRecord) {
    // do not set value for password input
    if (field.inputType === 'password') {
        return
    }
    // get value using either property or name fields
    var value = defined(data[field.property]) ? data[field.property] : data[field.name]
    // data is a record
    if (data.ImmutableCoreModelRecord) {
        // set record for field
        field.record = data
        // value was not found - could be due to resolving record so try to
        // lookup by default id column names
        if (!defined(value)) {
            // get default id column name from model
            var defaultIdColumnName = field.record.model.defaultColumns[field.property]
            // use for value if found
            if (defined(defaultIdColumnName)) {
                value = data[defaultIdColumnName]
            }
        }
    }
    // field is nested array
    if (field.nested && field.array) {
        setFieldValuesNestedArray(field, value)
    }
    // set value
    else {
        field.value = value
    }
    // if field is select then set selected flag on option that matches value
    if (field.inputType === 'select') {
        _.each(field.options, option => {
            option.selected = option.value === field.value
        })
    }
    // if field is immutable and it has a value then make it readonly
    if (isRecord && field.immutable && defined(field.value)) {
        field.readonly = true
    }
}
237231
function filter(obj) {
    var result = {}, fieldDefine, value;
    for(var field in options) {
      fieldDefine = options[field];
      value = obj[field];
      if(!fieldDefine.private && value !== undefined) {
        result[field] = value;
      }
    }
    return result;
  }
782877
function generateFilter(obj) {
    var type = obj.field in DATE_FIELDS ? 'date' : typeof obj.value;

    if (Utils.isArray(obj.value)) {
        if (type === 'object') {
            type = typeof obj.value[0];
        }
        obj.value = obj.value.toString();
    }

    return [type, obj.field, obj.param, obj.value].join(' ');
}
970011
def parse_selectors(model, fields=None, exclude=None, key_map=None, **options):
    
    fields = fields or DEFAULT_SELECTORS
    exclude = exclude or ()
    key_map = key_map or {}
    validated = []

    for alias in fields:
        # Map the output key name to the actual field/accessor name for
        # the model
        actual = key_map.get(alias, alias)

        # Validate the field exists
        cleaned = resolver.get_field(model, actual)

        if cleaned is None:
            raise AttributeError('The "{0}" attribute could not be found '
                                 'on the model "{1}"'.format(actual, model))

        # Mapped value, so use the original name listed in `fields`
        if type(cleaned) is list:
            validated.extend(cleaned)
        elif alias != actual:
            validated.append(alias)
        else:
            validated.append(cleaned)

    return tuple([x for x in validated if x not in exclude])
457599
def sanitize_params(inputs)
      out = {}.with_indifferent_access
      _fields.each_pair do |field, config|
        next unless inputs.key?(field)

        out[field] = ::Subroutine::TypeCaster.cast(inputs[field], config)
      end

      out
    end
134710
function sanitizeField (sanitizations, value, rules) {
  let result = value

  rules.forEach((rule) => {
    const ruleFn = snakeToCamelCase(rule.name)
    if (typeof (sanitizations[ruleFn]) !== 'function') {
      throw new Error(`${ruleFn} is not a sanitization method`)
    }
    result = sanitizations[ruleFn](result, rule.args)
  })

  return result
}
594417
function renderSearchFilters(req, fieldNames, data, modelName, cb) {

    if (!req) {
        throw new Error('req is required.');
    }

    if (!Array.isArray(fieldNames) || !fieldNames.length) {
        throw new Error('fieldNames is required and must be of type Array and cannot be empty.');
    }

    if (typeof modelName !== 'string' || !modelName.length) {
        throw new Error('modelName is required and must be of type String and cannot be empty.');
    }

    if (!(!Object.is(data, null) && !Array.isArray(data) && data === Object(data))) {
        throw new Error('data is required and must be of type Object.');
    }

    // Sort fieldNames (to make MongoDB queries more predictable, and therefore easier to create indexes for), remove duplicates, and remove anything that doesn't have associated data.
    fieldNames = dedupe(fieldNames.sort().filter(fieldName => Object.keys(data).indexOf(fieldName) >= 0));

    linz.api.model.list(req, modelName, function (err, list) {

        if (err) {
            return cb(err);
        }

        if (!Object.keys(list.filters).length) {
            return cb(null);
        }

        var model = linz.api.model.get(modelName),
            dataKeys = Object.keys(data),
            filters = {};

        async.each(fieldNames, function (fieldName, filtersDone) {

            if (!dataKeys.includes(fieldName)) {
                return filtersDone(null);
            }

            // call the filter renderer and update the content with the result
            list.filters[fieldName].filter.filter(fieldName, data, function (filterErr, result) {

                if (filterErr) {
                    return filtersDone(filterErr);
                }

                filters = model.addSearchFilter(filters, result);

                return filtersDone(null);

            });

        }, function (filterErr) {

            if (filterErr) {
                return cb(filterErr);
            }

            // consolidate filters into query
            filters = model.setFiltersAsQuery(filters);

            return cb(filterErr, filters);
        });

    });

}
959049
function DataModelMigration() {
    /**
     * Gets an array that contains the definition of fields that are going to be added
     * @type {Array}
     */
    this.add = [];
    /**
     * Gets an array that contains a collection of constraints which are going to be added
     * @type {Array}
     */
    this.constraints = [];
    /**
     * Gets an array that contains a collection of indexes which are going to be added or updated
     * @type {Array}
     */
    this.indexes = [];
    /**
     * Gets an array that contains the definition of fields that are going to be deleted
     * @type {Array}
     */
    this.remove = [];
    /**
     * Gets an array that contains the definition of fields that are going to be changed
     * @type {Array}
     */
    this.change = [];
    /**
     * Gets or sets a string that contains the internal version of this migration. This property cannot be null.
     * @type {string}
     */
    this.version = '0.0';
    /**
     * Gets or sets a string that represents a short description of this migration
     * @type {string}
     */
    this.description = null;
    /**
     * Gets or sets a string that represents the adapter that is going to be migrated through this operation.
     * This property cannot be null.
     */
    this.appliesTo = null;
    /**
     * Gets or sets a string that represents the model that is going to be migrated through this operation.
     * This property may be null.
     */
    this.model = null;
}
1028340
function initJsonSchema (args) {
    // get global validator instance
    var validator = this.global().validator
    // get schema id based on model name - must be globally unique
    this.schemaId = '/model/'+this.name
    // set option to perform schema validation on created/update
    this.validateSchema = args.validate === false ? false : true
    // create schema for model
    var schema = this.schemaMeta = {
        id: this.schemaId,
        properties: {},
        required: [],
        type: 'object',
    }
    // get data column
    var dataColumn = this.columnName('data')
    // create entry in schema for data if model has data
    if (dataColumn) {
        // schema id for data only
        this.schemaDataId = '/model/'+this.name+'/data'
        // create data schema - meta and data schemas are compiled without
        // ref so that the complete schemas can be easily sent to clients
        var schemaData = this.schemaData = schema.properties[dataColumn] = {
            additionalProperties: args.additionalProperties,
            id: this.schemaDataId,
            properties: {},
            type: 'object',
        }
        // merge schema from args over data schema
        _.merge(schemaData.properties, args.properties)
        // if required properties are set then add
        if (args.required) {
            // required must be array
            if (typeof args.required === 'string') {
                args.required = [args.required]
            }
            // throw error if not array
            assert.ok(Array.isArray(args.required), 'required must be array or string')
            // add list of required properties
            schemaData.required = args.required
        }
        // add data schema
        validator.addSchema(schemaData, this.schemaDataId)
    }
    // create schema for each default column
    _.each(this.defaultColumns, (defaultName, columnName) => {
        // skip data column which is already specified
        if (defaultName === 'data') {
            return
        }
        // get column spec
        var column = this.columns[columnName]
        // if there is not schema for type then skip
        if (!defaultSchemas[column.type]) {
            return
        }
        // get column schema
        var columnSchema = _.cloneDeep(defaultSchemas[column.type])
        // set default schema based on type
        schema.properties[columnName] = columnSchema
        // make property required unless nullable
        if (column.null === false) {
            schema.required.push(columnName)
        }
    })
    // add schema
    validator.addSchema(schema, this.schemaId)
}
1090556
function ( fields ) {

            var field, data = {}, key, value;

            for ( var i = fields.length - 1; i >= 0; i-- ) {

                field = fields[ i ];

                field.removeAttribute( 'name' );
                key = field.getAttribute( this.fieldNameAttribute );
                value = field.value;

                // Cater for select boxes
                if ( field.options && typeof field.selectedIndex !== "undefined" ) {
                    value = field.options[ field.selectedIndex ].value;
                }

                data[ key ] = value;

            }
            
            return data;

        }
1327317
function(field) {
      
      var key, label, colmunDef;
      
      // Retro-compatibility with inputParms
      if (lang.isObject(field.inputParams)) {
         key = field.inputParams.name;
         label = field.inputParams.label;
      
      // New prefered way to set options of a field
      } else {
         key = field.name;
         label = field.label;
      }
      
      columnDef = {
         key: key,
         label: label,
         sortable: true, 
         resizeable: true
      };

      // Field formatter
      if(field.type == "date") {
      	columnDef.formatter = YAHOO.widget.DataTable.formatDate;
      }
		else if(field.type == "integer" || field.type == "number") {
			columnDef.formatter = YAHOO.widget.DataTable.formatNumber;
			/*columnDef.sortOptions = {
				defaultDir: "asc",
				sortFunction: // TODO: sort numbers !!!
			}*/
		}
      // TODO: other formatters
      return columnDef;
   }
690814
function initFields () {
    // skip if no model
    if (!this.model) {
        return
    }
    // if not fields list was passed in args then add all model properties
    if (!this.fields.length && this.model.schemaData) {
        // get data properites from schema
        var properties = this.model.schemaData.properties
        // add each property from data schema as form field
        _.each(properties, (schema, property) => {
            this.fields.push(property)
        })
    }
    // iterate over fields building spec based on args and schema
    this.fields = _.map(this.fields, field => {
        // field group
        if (Array.isArray(field)) {
            // build spec for each field in group
            field = _.map(field, field => initField(this, field))
            // set correct width units for fields
            setUnits(this, field)
        }
        // individual field
        else {
            field = initField(this, field)
        }
        // return field specification
        return field
    })
}