MCPcopy
hub / github.com/webpack/webpack / compileBooleanMatcher

Function compileBooleanMatcher

lib/util/compileBooleanMatcher.js:106–112  ·  view source on GitHub ↗
(map)

Source from the content-addressed store, hash-verified

104 * @returns {boolean | ((value: string) => string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime
105 */
106const compileBooleanMatcher = (map) => {
107 const positiveItems = Object.keys(map).filter((i) => map[i]);
108 const negativeItems = Object.keys(map).filter((i) => !map[i]);
109 if (positiveItems.length === 0) return false;
110 if (negativeItems.length === 0) return true;
111 return compileBooleanMatcherFromLists(positiveItems, negativeItems);
112};
113
114/**
115 * Compile boolean matcher from lists.

Callers 6

generateMethod · 0.50
generateMethod · 0.50
generateMethod · 0.50
generateMethod · 0.50
generateMethod · 0.50
generateMethod · 0.50

Calls 2

keysMethod · 0.65

Tested by

no test coverage detected