MCPcopy
hub / github.com/webpack/webpack / checkTest

Function checkTest

lib/hmr/LazyCompilationPlugin.js:160–174  ·  view source on GitHub ↗
(test, module)

Source from the content-addressed store, hash-verified

158 * @returns {boolean | null | string} true, if the module should be selected
159 */
160const checkTest = (test, module) => {
161 if (test === undefined) return true;
162 if (typeof test === "function") {
163 return test(module);
164 }
165 if (typeof test === "string") {
166 const name = module.nameForCondition();
167 return name && name.startsWith(test);
168 }
169 if (test instanceof RegExp) {
170 const name = module.nameForCondition();
171 return name && test.test(name);
172 }
173 return false;
174};
175
176class LazyCompilationDependency extends Dependency {
177 /**

Callers 1

applyMethod · 0.70

Calls 3

testFunction · 0.50
nameForConditionMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected