Merges provided layers into a single config object,
respecting order of the layers

@param   {array} layers - list of config objects
@returns {object} - single config object
773674
function mergeLayers(layers)
{
  var _instance = this
    , result    = null
    ;

  layers.forEach(function(layer)
  {
    layer.exts.forEach(function(ext)
    {
      ext.dirs.forEach(function(cfg)
      {
        // have customizable's array merge function
        result = merge.call({
          useCustomAdapters: merge.behaviors.useCustomAdapters,
          'array': _instance.arrayMerge,
          useCustomTypeOf: merge.behaviors.useCustomTypeOf,
          'typeof': _instance.mergeTypeOf
        }, result || {}, cfg.config);
      });
    });
  });

  // return `null` if noting found
  // and let downstream layers to make the decision
  return result;
}
421553
function generateLayerMetaForSplitViews(layer) {
  return {
    isAvailable: layer.config.isVisible,
    isVisible: layer.config.isVisible
  };
}
1157646
function addNewLayersToSplitMap(splitMaps, layers) {
  const newLayers = Array.isArray(layers) ? layers : [layers];

  if (!splitMaps || !splitMaps.length || !newLayers.length) {
    return splitMaps;
  }

  // add new layer to both maps,
  //  don't override, if layer.id is already in splitMaps.settings.layers
  return splitMaps.map(settings => ({
    ...settings,
    layers: {
      ...settings.layers,
      ...newLayers.reduce(
        (accu, newLayer) =>
          newLayer.config.isVisible
            ? {
                ...accu,
                [newLayer.id]: settings.layers[newLayer.id]
                  ? settings.layers[newLayer.id]
                  : generateLayerMetaForSplitViews(newLayer)
              }
            : accu,
        {}
      )
    }
  }));
}
724705
function mergeOptions(config, pass) {
      var _this = this;

      var result = loadConfig(config);

      var plugins = result.plugins.map(function (descriptor) {
        return loadPluginDescriptor(descriptor);
      });
      var presets = result.presets.map(function (descriptor) {
        return loadPresetDescriptor(descriptor);
      });

      if (config.options.passPerPreset != null && typeof config.options.passPerPreset !== "boolean") {
        throw new Error(".passPerPreset must be a boolean or undefined");
      }
      var passPerPreset = config.options.passPerPreset;
      pass = pass || this.passes[0];

      // resolve presets
      if (presets.length > 0) {
        var presetPasses = null;
        if (passPerPreset) {
          var _passes;

          presetPasses = presets.map(function () {
            return [];
          });
          // The passes are created in the same order as the preset list, but are inserted before any
          // existing additional passes.
          (_passes = this.passes).splice.apply(_passes, [1, 0].concat((0, _toConsumableArray3.default)(presetPasses)));
        }

        presets.forEach(function (presetConfig, i) {
          _this.mergeOptions(presetConfig, presetPasses ? presetPasses[i] : pass);
        });
      }

      // resolve plugins
      if (plugins.length > 0) {
        var _pass;

        (_pass = pass).unshift.apply(_pass, (0, _toConsumableArray3.default)(plugins));
      }

      (0, _merge2.default)(this.options, result.options);
    }
853881
function merge(target, options) {
  var key;
  if (!target) { target = {}; }
  if (options) {
    for (key in options) {
      if (options.hasOwnProperty(key)) {
        var targetHasIt = target.hasOwnProperty(key),
            optionsValueType = typeof options[key],
            shouldReplace = !targetHasIt || (typeof target[key] !== optionsValueType);

        if (shouldReplace) {
          target[key] = options[key];
        } else if (optionsValueType === 'object') {
          // go deep, don't care about loops here, we are simple API!:
          target[key] = merge(target[key], options[key]);
        }
      }
    }
  }

  return target;
}
21744
function combine () {
  var config = {}
  Array.prototype.forEach.call(arguments, function (tconsoleInstance) {
    mergeObject(config, tconsoleInstance._tconsoleConfig)
  })
  return createConsole(config)
}
1355205
function() {
        for (var i=0, len=this.layers.length; i<len; i++) {
            var layer = this.layers[i];
            this.setLayerZIndex(layer, i);
        }
    }
1226328
function buildLayers(layersObject) {
	// Array of layers
	var layers = [];

	if (layersObject) {
		// Iterate over all layers
		for (var int = 0; int < layersObject.length; int++) {
			// One layer
			var singleLayer = layersObject[int];

			// Build a new layer object
			var layer = {};

			// Determine name from GetCapabilities document
			if (singleLayer.Name) {
				if (singleLayer.Name[0]) {
					layer.Name = singleLayer.Name[0];
				}
			}

			// Determine title from GetCapabilities document
			if (singleLayer.Title) {
				if (singleLayer.Title[0]) {
					layer.Title = singleLayer.Title[0];
				}
			}

			// Determine abstract from GetCapabilities document
			if (singleLayer.Abstract) {
				if (singleLayer.Abstract[0]) {
					layer.Abstract = singleLayer.Abstract[0];
				}
			}

			layer.Layer = buildLayers(singleLayer.Layer);

			// Determine layer name if not available
			layer.Name = determineLayerName(layer);

			// Determine layer title if not available
			if (!(layer.Title)) {
				layer.Title = layer.Name;
			}

			// Add layer to the array
			layers.push(layer);
		}
	}

	return layers;
}
40307
function copyJS() {
    let tasks = [];
    Object.keys(config).forEach((key) => {
        let val = config[key];
        tasks.push(gulp.src(val.src).pipe(gulp.dest(val.dest)));
    });

    return merge(tasks);
}
157339
function mergeObjects(var_args) {
  var merged = {};
  var objects = Array.prototype.slice.call(arguments);
  objects.forEach(function(obj) {
    Object.keys(obj).forEach(function(key) {
      merged[key] = obj[key];
    });
  });
  return merged;
}
785338
function merge (a, b) {
    var result = {};
    var x;

    for (x in a) {
      if (a.hasOwnProperty(x)) {
        result[x] = a[x];
      }
    }

    for (x in b) {
      if (b.hasOwnProperty(x)) {
        result[x] = b[x];
      }
    }

    return result;
  }
483328
function buildLayers() {
            dataByDateFormatted = dataByDate
                .map(d => assign({}, d, d.values))
                .map(d => {
                    Object.keys(d).forEach(k => {
                        const entry = d[k];

                        if (entry && entry.name) {
                            d[entry.name] = entry.value;
                        }
                    });

                    return assign({}, d, {
                        date: new Date(d['key'])
                    });
                });

            dataByDateZeroed = dataByDate
                .map(d => assign({}, d, d.values))
                .map(d => {
                    Object.keys(d).forEach(k => {
                        const entry = d[k];

                        if (entry && entry.name) {
                            d[entry.name] = 0;
                        }
                    });

                    return assign({}, d, {
                        date: new Date(d['key'])
                    });
                });

            let initialTotalsObject = uniq(data.map(getName))
                                        .reduce((memo, key) => (
                                            assign({}, memo, {[key]: 0})
                                        ), {});

            let totals = data
                .reduce((memo, item) => (
                    assign({}, memo, {[item.name]: memo[item.name] += item.value})
                ), initialTotalsObject);

            order = topicsOrder || formatOrder(totals);

            let stack3 = d3Shape.stack()
                .keys(order)
                .order(d3Shape.stackOrderNone)
                .offset(d3Shape.stackOffsetNone);

            layersInitial = stack3(dataByDateZeroed);
            layers = stack3(dataByDateFormatted);
        }
323981
protected function mergeConfigs(array $configs)
    {
        $mergedConfig = array();
        
        foreach($configs as $config)
        {
            $mergedConfig = array_merge_recursive($mergedConfig, $config);
        }
        
        return  array($mergedConfig);
    }
32972
function getLayers(elements) {
  if (elements.length === 0) {
    return [[""]];
  }
  const layers = [];
  layers.push(elements);
  while (layers[layers.length - 1].length > 1) {
    layers.push(getNextLayer(layers[layers.length - 1]));
  }
  return layers;
}
243474
def merge_configs(self, config, datas):
        
        if not isinstance(config, dict) or len([x for x in datas if not isinstance(x, dict)]) > 0:
            raise TypeError("Unable to merge: Dictionnary expected")

        for key, value in config.items():
            others = [x[key] for x in datas if key in x]
            if len(others) > 0:
                if isinstance(value, dict):
                    config[key] = self.merge_configs(value, others)
                else:
                    config[key] = others[-1]
        return config
519064
function buildLayers() {
            layers = transformedData.map((item) => {
                let ret = {};

                groups.forEach((key) => {
                    ret[key] = item[key];
                });

                return assign({}, item, ret);
            });
        }
732771
def concatenate(*layers):  # pragma: no cover
    
    if not layers:
        return noop()
    ops = layers[0].ops

    def begin_update(X, *a, **k):
        forward, backward = split_backward(layers)
        values = [fwd(X, *a, **k) for fwd in forward]

        output = ops.xp.hstack(values)
        shapes = [val.shape for val in values]

        def finish_update(gradient, *args, **kwargs):
            layer_grads = []
            start = 0
            for bwd, shape in zip(backward, shapes):
                end = start + shape[1]
                if bwd is not None:
                    d = bwd(
                        ops.xp.ascontiguousarray(gradient[:, start:end]),
                        *args,
                        **kwargs
                    )
                    if d is not None and hasattr(X, "shape"):
                        if not layer_grads:
                            layer_grads.append(d)
                        else:
                            layer_grads[-1] += d
                start = end
            if layer_grads:
                return ops.asarray(layer_grads[-1])
            else:
                return None

        return output, finish_update

    layer = FunctionLayer(begin_update)
    layer._layers = list(layers)

    def on_data(self, X, y=None):
        for layer in self._layers:
            for hook in layer.on_data_hooks:
                hook(layer, X, y)

    layer.on_data_hooks.append(on_data)
    return layer