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

Function checkTest

lib/optimize/SplitChunksPlugin.js:576–591  ·  view source on GitHub ↗
(test, module, context)

Source from the content-addressed store, hash-verified

574 * @returns {boolean} true, if the module should be selected
575 */
576const checkTest = (test, module, context) => {
577 if (test === undefined) return true;
578 if (typeof test === "function") {
579 return test(module, context);
580 }
581 if (typeof test === "boolean") return test;
582 if (typeof test === "string") {
583 const name = module.nameForCondition();
584 return name ? name.startsWith(test) : false;
585 }
586 if (test instanceof RegExp) {
587 const name = module.nameForCondition();
588 return name ? test.test(name) : false;
589 }
590 return false;
591};
592
593/** @typedef {(type: string) => boolean} CheckModuleTypeFn */
594

Callers 1

normalizeCacheGroupsFunction · 0.70

Calls 3

testFunction · 0.50
nameForConditionMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected