code: function _updateLayerName($canvas, data, layer, props) {
  	var nameMap = data.layer.names;
  
  	// If layer name is being added, not changed
  	if (!props) {
  
  		props = layer;
  
  	} else {
  
  		// Remove old layer name entry because layer name has changed
  		if (props.name !== undefined && isString(layer.name) && layer.name !== props.name) {
  			delete nameMap[layer.name];
  		}
  
  	}
  
  	// Add new entry to layer name map with new name
  	if (isString(props.name)) {
  		nameMap[props.name] = layer;
  	}
  }
docs: Update a layer property map if property is changed