function setLayerInGroupVisible(state, action) {
  const updated_layers = [];
  for (let i = 0, ii = state.layers.length; i < ii; i++) {
    const layer = state.layers[i];
    if (layer.metadata && layer.metadata[GROUP_KEY] === action.groupId) {
      updated_layers.push({
        ...layer,
        layout: {
          ...layer.layout,
          visibility: layer.id === action.layerId ? 'visible' : 'none',
        },
      });
    } else {
      updated_layers.push(layer);
    }
  }
  return Object.assign({}, state, {
    layers: updated_layers,
  }, incrementVersion(state.metadata, LAYER_VERSION_KEY));
}
function setLayerInGroupVisible(state, action) {
  const updated_layers = [];
  for (let i = 0, ii = state.layers.length; i < ii; i++) {
    const layer = state.layers[i];
    if (layer.metadata && layer.metadata[GROUP_KEY] === action.groupId) {
      updated_layers.push({
        ...layer,
        layout: {
          ...layer.layout,
          visibility: layer.id === action.layerId ? 'visible' : 'none',
        },
      });
    } else {
      updated_layers.push(layer);
    }
  }
  return Object.assign({}, state, {
    layers: updated_layers,
  }, incrementVersion(state.metadata, LAYER_VERSION_KEY));
}
function setLayerInGroupVisible ( state , action ) { const updated_layers = [ ] ; for ( let i = 0 , ii = state . layers . length ; i < ii ; i ++ ) { const layer = state . layers [ i ] ; if ( layer . metadata && layer . metadata [ GROUP_KEY ] === action . groupId ) { updated_layers . push ( { ... layer , layout : { ... layer . layout , visibility : layer . id === action . layerId ? 'visible' : 'none' , } , } ) ; } else { updated_layers . push ( layer ) ; } } return Object . assign ( { } , state , { layers : updated_layers , } , incrementVersion ( state . metadata , LAYER_VERSION_KEY ) ) ; }
Set a layer visible in a mutually exclusive group.
@param {Object} state Current state.
@param {Object} action Action to handle.

@returns {Object} The new state.
Set a layer visible in a mutually exclusive group . @param { Object } state Current state . @param { Object } action Action to handle .