src/index.js
function transformFeature (feature, fields) {
  const attributes = {}

  // first transform each of the features to the converted field name and transformed value
  if (feature.attributes && Object.keys(feature.attributes)) {
    _.each(Object.keys(feature.attributes), (name) => {
      let attr = {}
      attr[name] = feature.attributes[name]
      try {
        attributes[fields[name].outName] = convertAttribute(attr, fields[name])
      } catch (e) {
        console.error('Field was missing from attribute')
      }
    })
  }

  return {
    type: 'Feature',
    properties: attributes,
    geometry: parseGeometry(feature.geometry)
  }
}
function transformFeature (feature, fields) {
  const attributes = {}

  // first transform each of the features to the converted field name and transformed value
  if (feature.attributes && Object.keys(feature.attributes)) {
    _.each(Object.keys(feature.attributes), (name) => {
      let attr = {}
      attr[name] = feature.attributes[name]
      try {
        attributes[fields[name].outName] = convertAttribute(attr, fields[name])
      } catch (e) {
        console.error('Field was missing from attribute')
      }
    })
  }

  return {
    type: 'Feature',
    properties: attributes,
    geometry: parseGeometry(feature.geometry)
  }
}
function transformFeature ( feature , fields ) { const attributes = { } // first transform each of the features to the converted field name and transformed value if ( feature . attributes && Object . keys ( feature . attributes ) ) { _ . each ( Object . keys ( feature . attributes ) , ( name ) => { let attr = { } attr [ name ] = feature . attributes [ name ] try { attributes [ fields [ name ] . outName ] = convertAttribute ( attr , fields [ name ] ) } catch ( e ) { console . error ( 'Field was missing from attribute' ) } } ) } return { type : 'Feature' , properties : attributes , geometry : parseGeometry ( feature . geometry ) } }
Converts a single feature from esri json to geojson

@param {object} feature - a single esri feature
@param {object} fields - the fields object from the service
@returns {object} feature - a geojson feature
@private
Converts a single feature from esri json to geojson