src/options/normalizeOptions.js
function normalizeIdField (options, features = []) {
  const collection = options.collection || {}
  const metadata = collection.metadata || {}
  const feature = features[0] || {}
  const featureProperties = feature.properties || feature.attributes || {}
  let idField = null

  // First, check metadata for idField
  if (metadata.idField) idField = metadata.idField

  // Check metadata.fields for and OBJECTID property
  else if (_.find(metadata.fields, { name: 'OBJECTID' })) idField = 'OBJECTID'
  // Check features for an OBJECTID property that is not null
  else if (features.length > 0 && !_.isUndefined(featureProperties.OBJECTID) && !_.isNull(featureProperties.OBJECTID)) idField = 'OBJECTID'

  // If there are features, check that the idField is one of the properties
  if (process.env.NODE_ENV !== 'production' && process.env.KOOP_WARNINGS !== 'suppress' && idField && features.length > 0 && !featureProperties[idField]) {
    console.warn(`WARNING: requested provider has "idField" assignment, but this property is not found in properties of all features.`)
  }

  return idField
}
function normalizeIdField (options, features = []) {
  const collection = options.collection || {}
  const metadata = collection.metadata || {}
  const feature = features[0] || {}
  const featureProperties = feature.properties || feature.attributes || {}
  let idField = null

  // First, check metadata for idField
  if (metadata.idField) idField = metadata.idField

  // Check metadata.fields for and OBJECTID property
  else if (_.find(metadata.fields, { name: 'OBJECTID' })) idField = 'OBJECTID'
  // Check features for an OBJECTID property that is not null
  else if (features.length > 0 && !_.isUndefined(featureProperties.OBJECTID) && !_.isNull(featureProperties.OBJECTID)) idField = 'OBJECTID'

  // If there are features, check that the idField is one of the properties
  if (process.env.NODE_ENV !== 'production' && process.env.KOOP_WARNINGS !== 'suppress' && idField && features.length > 0 && !featureProperties[idField]) {
    console.warn(`WARNING: requested provider has "idField" assignment, but this property is not found in properties of all features.`)
  }

  return idField
}
function normalizeIdField ( options , features = [ ] ) { const collection = options . collection || { } const metadata = collection . metadata || { } const feature = features [ 0 ] || { } const featureProperties = feature . properties || feature . attributes || { } let idField = null // First, check metadata for idField if ( metadata . idField ) idField = metadata . idField // Check metadata.fields for and OBJECTID property else if ( _ . find ( metadata . fields , { name : 'OBJECTID' } ) ) idField = 'OBJECTID' // Check features for an OBJECTID property that is not null else if ( features . length > 0 && ! _ . isUndefined ( featureProperties . OBJECTID ) && ! _ . isNull ( featureProperties . OBJECTID ) ) idField = 'OBJECTID' // If there are features, check that the idField is one of the properties if ( process . env . NODE_ENV !== 'production' && process . env . KOOP_WARNINGS !== 'suppress' && idField && features . length > 0 && ! featureProperties [ idField ] ) { console . warn ( ` ` ) } return idField }
Ensure idField is set if metadata doesn't have a value but a field named OBJECTID is present
@param {object} metadata
Ensure idField is set if metadata doesn t have a value but a field named OBJECTID is present