src/reducers/map.js
function addLayer(state, action) {
  // TODO: Maybe decide on what a "default case" is in
  //       order to support easier dev.
  const new_layer = Object.assign({
    paint: {},
    metadata: {},
  }, action.layerDef);

  // add a layer name if specified in the action.
  if (action.layerTitle) {
    new_layer.metadata[TITLE_KEY] = action.layerTitle;
  }

  return placeLayer(state, new_layer, action.positionId);
}
function addLayer(state, action) {
  // TODO: Maybe decide on what a "default case" is in
  //       order to support easier dev.
  const new_layer = Object.assign({
    paint: {},
    metadata: {},
  }, action.layerDef);

  // add a layer name if specified in the action.
  if (action.layerTitle) {
    new_layer.metadata[TITLE_KEY] = action.layerTitle;
  }

  return placeLayer(state, new_layer, action.positionId);
}
function addLayer ( state , action ) { // TODO: Maybe decide on what a "default case" is in //       order to support easier dev. const new_layer = Object . assign ( { paint : { } , metadata : { } , } , action . layerDef ) ; // add a layer name if specified in the action. if ( action . layerTitle ) { new_layer . metadata [ TITLE_KEY ] = action . layerTitle ; } return placeLayer ( state , new_layer , action . positionId ) ; }
Add a layer to the state.
@param {Object} state Current state.
@param {Object} action Action to handle.

@returns {Object} The new state.
Add a layer to the state . @param { Object } state Current state . @param { Object } action Action to handle .