Extend plugins with the custom config object.

@param {Array} plugins input plugins
@param {Object} config config
@return {Array} output plugins
777825
function extendConfig(defaults, config) {

        var key;

        // plugins
        if (config.plugins) {

            config.plugins.forEach(function(item) {

                // {}
                if (typeof item === 'object') {

                    key = Object.keys(item)[0];

                    // custom
                    if (typeof item[key] === 'object' && item[key].fn && typeof item[key].fn === 'function') {
                        defaults.plugins.push(setupCustomPlugin(key, item[key]));

                    } else {
                        defaults.plugins.forEach(function(plugin) {

                            if (plugin.name === key) {
                                // name: {}
                                if (typeof item[key] === 'object') {
                                    plugin.params = EXTEND({}, plugin.params || {}, item[key]);
                                    plugin.active = true;

                                // name: false
                                } else if (item[key] === false) {
                                   plugin.active = false;

                                // name: true
                                } else if (item[key] === true) {
                                   plugin.active = true;
                                }
                            }
                        });
                    }

                }

            });

        }

        defaults.multipass = config.multipass;

        // svg2js
        if (config.svg2js) {
            defaults.svg2js = config.svg2js;
        }

        // js2svg
        if (config.js2svg) {
            defaults.js2svg = config.js2svg;
        }

        return defaults;

    }
182952
def new_plugin(self, config, *args, **kwargs):
        
        typ = None
        obj = None

        # if type is defined, create a new instance
        if 'type' in config:
            typ = config['type']

        # single key is overriding an existing plugin instance
        elif isinstance(config, collections.Mapping) and len(config) == 1:
            # get type name and shift out config to parent level
            (typ, config) = list(config.items())[0]

        obj = self._ctor(typ, config, *args, **kwargs)

        # store if named
        if 'name' in config:
            self._instance[config['name']] = obj
        else:
            # this could dupe on .name, make name=''?
            config['name'] = typ

        return obj
1278154
function _withPlugins(fn) {
  return function() {
    const args = Array.from(arguments);
    const opts = args[1] || {};
    args[1] = Object.assign({}, opts, {
      plugins: loadPlugins(opts.plugins, opts.pluginSearchDirs)
    });
    return fn.apply(null, args);
  };
}
813408
function setConfig(configs) {
    configProperties = platformConfigs;
    provider.platform[platformName] = {};

    addConfig(configProperties, configProperties.platform[platformName]);

    createConfig(configProperties.platform[platformName], provider.platform[platformName], '');
  }
831333
function (defaults, configure) {
        for (var key in defaults) {
            if (defaults.hasOwnProperty(key)) {
                if (typeof defaults[key] === 'object') {
                    // recursive
                    if (typeof configure[key] === 'object') {
                        overwriteConfig(defaults[key], configure[key]);
                    }
                } else {
                    // copy directly
                    if (typeof configure[key] !== 'undefined') {
                        defaults[key] = configure[key];
                    }
                }
            }
        }
    }
1105284
protected function loadExtensions(Config $config)
    {
        $uses = $config->get('uses', []);

        foreach ($uses as $use => $useSettings) {
            $this->loadExtension($use, $useSettings, $config);
        }

        return $this;
    }
623622
function pluginFlags(plugins) {
  var pflags = [];
  var len = 0;

  plugins.forEach(function(plugin) {
    Object.keys(plugin.flags || {}).forEach(function(flag) {
      pflags.push([flag, plugin.flags[flag]]);
      len = Math.max(flag.length, len);
    });
  });

  if (pflags.length) {
    console.log();
    console.log('Plugin flags:');
    console.log();
    pflags.forEach(function(flag) {
      console.log('  %s   %s', ljust(flag[0], len), flag[1]);
    });
  }

  console.log();
}
26665
public void addPlugins(String pluginTypeNames) {
		String[] pluginTypeNameList = pluginTypeNames.split(",");
		for (String pluginTypeName : pluginTypeNameList) {
			pluginTypeName = pluginTypeName.trim();
			if (!pluginTypeName.equals("")) {
				addPlugin(pluginTypeName);
			}
		}
	}
981477
function buildBabelConfig(filename, options) {
  const babelRC = getBabelRC(options.projectRoots);

  const extraConfig = {
    code: false,
    filename,
  };

  let config = Object.assign({}, babelRC, extraConfig);

  // Add extra plugins
  const extraPlugins = [externalHelpersPlugin];

  var inlineRequires = options.inlineRequires;
  var blacklist = inlineRequires && inlineRequires.blacklist;
  if (inlineRequires && !(blacklist && filename in blacklist)) {
    extraPlugins.push(inlineRequiresPlugin);
  }

  config.plugins = extraPlugins.concat(config.plugins);

  if (options.hot) {
    const hmrConfig = makeHMRConfig(options, filename);
    config = Object.assign({}, config, hmrConfig);
  }

  return Object.assign({}, babelRC, config);
}
1041333
function( config ) {
			!is_obj( config ) || Object.keys( config ).forEach( function( key ) {
				if ( typeof config[key] == 'function' && typeof this[key] == 'function' ) // this allows you to override a method for a
					this[__override__]( key, config[key] );         // specific instance of a Class, rather than require
				else                                                // you extend the Class for a few minor changes
					this[key] = config[key];                        // NB: can also be achieved by creating a `singleton`
			}, this );

			util.def( this, __config__, { value : config }, 'r', true );
		}
1208232
function gulpSVGSprite(config) {

	// Extend plugin error
	function extendError(pError, error) {
		if (error && (typeof error === 'object')) {
			['name', 'errno'].forEach(function(property) {
				if (property in error) {
					this[property]	= error[property];
				}
			}, pError);
		}

		return pError;
	}

	// Instanciate spriter instance
	var spriter						= new SVGSpriter(config);
	var shapes						= 0;

	// Intercept error log and convert to plugin errors
	spriter.config.log.error		= function(message, error) {
		this.emit('error', extendError(new PluginError(PLUGIN_NAME, message), error));
	};

	return through2.obj(function (file, enc, cb) {
		var error					= null;
		try {
			spriter.add(file);
			++shapes;
		} catch(e) {
			error					= (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
		}
		return cb(error);

	}, function(cb) {
		var stream 					= this;
		spriter.compile(function(error, result /*, data*/){
			if (error) {
				stream.emit('error', new PluginError(PLUGIN_NAME, error));
			} else if (shapes > 0) {
				for (var mode in result) {
					for (var resource in result[mode]) {
						stream.push(result[mode][resource]);
					}
				}
			}
			cb();
		});
	});
}
1361806
function prepare(config) {
  config = config || {};
  var settings = config.settings && config.settings[constants.PLUGIN_NAME] || {};

  // Set paths, convert string values to array
  settings.paths = objValuesToArray(settings.paths || {});

  // Set allExceptPaths, convert string values to array
  settings.allExceptPaths = objValuesToArray(settings.allExceptPaths || {});

  // Set options for multimatch module
  settings.pathsOptions = settings.pathsOptions || defaults.pathsOptions;

  // Forward plugins from config or use custom ones, remove current plugin
  settings.plugins = toArray(settings.plugins || config.plugins || []);
  var index = settings.plugins.indexOf(constants.PLUGIN_NAME_SHORT);
  if (index > -1) {
    settings.plugins.splice(index, 1);
  }

  settings.cliArgs = settings.cliArgs || [];

  return settings;
}
440654
function addPlugin(config, pluginName, version) {
    // For default plugin, we only ensure it is enabled
    if (isDefaultPlugin(pluginName, version)) {
        return togglePlugin(config, pluginName, true);
    }

    var deps = config.getPluginDependencies();
    var dep = PluginDependency.create(pluginName, version);

    deps = deps.push(dep);
    return config.setPluginDependencies(deps);
}
715694
function (config) {
  this.globals = config.globals || {};
  this.templates = {};
  this.config = _.extend({}, defaults, config);
  this.config.optionsRegex = new RegExp("^" + this.config.optionsDelimiter + "([\\S\\s]+)" + this.config.optionsDelimiter + "([\\S\\s]+)");
}
68412
def extend_config(config, config_items):
    
    for key, val in list(config_items.items()):
        if hasattr(config, key):
            setattr(config, key, val)

    return config
804849
function optimizePluginsArray(plugins) {

        var prev;

        return plugins.reduce(function(plugins, item) {
            if (prev && item.type == prev[0].type) {
                prev.push(item);
            } else {
                plugins.push(prev = [item]);
            }
            return plugins;
        }, []);

    }
23284
function parsePlugins(config) {
  let plugins = [];

  function parse(plugins) {
    return plugins.map(plugin => {
      if ('string' == typeof plugin) plugin = path.resolve(plugin);
      return plugin;
    });
  }

  // Handle plugin paths defined in config file
  if (config.plugins) {
    plugins.push(...parse(config.plugins));
    delete config.plugins;
  }
  // Handle plugin paths/functions defined in runtime options
  if (config.runtimeOptions.plugins) {
    plugins.push(...parse(config.runtimeOptions.plugins));
    delete config.runtimeOptions.plugins;
  }

  return plugins;
}