src/components/map.js
function configureSource(glSource, mapView, accessToken, baseUrl, time, wrapX, fetchOptions) {
  let src;
  // tiled raster layer.
  if (glSource.type === 'raster') {
    if ('tiles' in glSource) {
      src = configureTileSource(glSource, mapView.getProjection(), time, fetchOptions);
    } else if (glSource.url) {
      src = configureTileJSONSource(glSource, accessToken);
    }
  } else if (glSource.type === 'geojson') {
    src = configureGeojsonSource(glSource, mapView, baseUrl, wrapX, fetchOptions);
  } else if (glSource.type === 'image') {
    src = configureImageSource(glSource);
  } else if (glSource.type === 'vector') {
    return configureMvtSource(glSource, accessToken, fetchOptions);
  }
  return new Promise((resolve, reject) => {
    resolve(src);
  });
}
function configureSource(glSource, mapView, accessToken, baseUrl, time, wrapX, fetchOptions) {
  let src;
  // tiled raster layer.
  if (glSource.type === 'raster') {
    if ('tiles' in glSource) {
      src = configureTileSource(glSource, mapView.getProjection(), time, fetchOptions);
    } else if (glSource.url) {
      src = configureTileJSONSource(glSource, accessToken);
    }
  } else if (glSource.type === 'geojson') {
    src = configureGeojsonSource(glSource, mapView, baseUrl, wrapX, fetchOptions);
  } else if (glSource.type === 'image') {
    src = configureImageSource(glSource);
  } else if (glSource.type === 'vector') {
    return configureMvtSource(glSource, accessToken, fetchOptions);
  }
  return new Promise((resolve, reject) => {
    resolve(src);
  });
}
Configures a Mapbox GL source object into appropriate
an appropriatly typed OpenLayers source object.
@param {Object} glSource The source object.
@param {Object} mapView The OpenLayers view object.
@param {string} accessToken A Mapbox access token.
@param {string} baseUrl A baseUrl provided by this.props.mapbox.baseUrl.
@param {string} time The current time if time-enabled.
@param {boolean} wrapX Should we wrap the world?
@param {Object} fetchOptions Options to use for fetch calls.

@returns {(Object|null)} Callback to the applicable configure source method.