MCPcopy
hub / github.com/webpack/webpack / iterateConfig

Function iterateConfig

lib/stats/DefaultStatsFactoryPlugin.js:2662–2683  ·  view source on GitHub ↗
(config, options, fn)

Source from the content-addressed store, hash-verified

2660 * @returns {void}
2661 */
2662const iterateConfig = (config, options, fn) => {
2663 for (const hookFor of Object.keys(config)) {
2664 const subConfig = config[hookFor];
2665 for (const option of Object.keys(subConfig)) {
2666 if (option !== "_") {
2667 if (option.startsWith("!")) {
2668 if (options[option.slice(1)]) continue;
2669 } else {
2670 const value = options[option];
2671 if (
2672 value === false ||
2673 value === undefined ||
2674 (Array.isArray(value) && value.length === 0)
2675 ) {
2676 continue;
2677 }
2678 }
2679 }
2680 fn(hookFor, subConfig[option]);
2681 }
2682 }
2683};
2684
2685/** @type {Record<string, string>} */
2686const ITEM_NAMES = {

Callers 1

applyMethod · 0.85

Calls 4

sliceMethod · 0.80
isArrayMethod · 0.80
keysMethod · 0.65
fnFunction · 0.50

Tested by

no test coverage detected