lib/merge_layers.js
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;
}
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;
}
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 ; }
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
Merges provided layers into a single config object respecting order of the layers