index.js
function request(url, geojsonParser, params = {}, options = utils.Options) {
  // Create custom Axios instance
  const instance = axios.create({})

  // Remove any existing default Authorization headers
  if (instance.defaults.headers.common && instance.defaults.headers.common.Authorization) { delete instance.defaults.headers.common.Authorization }
  if (instance.defaults.headers.Authorization) { delete instance.defaults.headers.Authorization }

  // Handle request
  return new Promise((resolve, reject) => {
    instance.get(url, {params}).then(response => {
      if (options.raw !== undefined) { return resolve(response.data) }
      const geojson = geojsonParser(response.data, options)
      return resolve(geojson)
    })
  })
}
function request(url, geojsonParser, params = {}, options = utils.Options) {
  // Create custom Axios instance
  const instance = axios.create({})

  // Remove any existing default Authorization headers
  if (instance.defaults.headers.common && instance.defaults.headers.common.Authorization) { delete instance.defaults.headers.common.Authorization }
  if (instance.defaults.headers.Authorization) { delete instance.defaults.headers.Authorization }

  // Handle request
  return new Promise((resolve, reject) => {
    instance.get(url, {params}).then(response => {
      if (options.raw !== undefined) { return resolve(response.data) }
      const geojson = geojsonParser(response.data, options)
      return resolve(geojson)
    })
  })
}
function request ( url , geojsonParser , params = { } , options = utils . Options ) { // Create custom Axios instance const instance = axios . create ( { } ) // Remove any existing default Authorization headers if ( instance . defaults . headers . common && instance . defaults . headers . common . Authorization ) { delete instance . defaults . headers . common . Authorization } if ( instance . defaults . headers . Authorization ) { delete instance . defaults . headers . Authorization } // Handle request return new Promise ( ( resolve , reject ) => { instance . get ( url , { params } ) . then ( response => { if ( options . raw !== undefined ) { return resolve ( response . data ) } const geojson = geojsonParser ( response . data , options ) return resolve ( geojson ) } ) } ) }
Generic GET function to normalize all of the requests

@param {string} url URL
@param {function} geojsonParser Customized function to generate a GeoJSON Point FeatureCollection
@param {Object} params Query String
@param {Object} options Options used for HTTP request & GeoJSON Parser function
@returns {Promise<Points>} Results in GeoJSON FeatureCollection Points
Generic GET function to normalize all of the requests