MCPcopy
hub / github.com/webpack/webpack / matchPart

Function matchPart

lib/ModuleFilenameHelpers.js:340–351  ·  view source on GitHub ↗
(str, test)

Source from the content-addressed store, hash-verified

338 * ```
339 */
340const matchPart = (str, test) => {
341 if (!test) return true;
342 if (test instanceof RegExp) {
343 return test.test(str);
344 } else if (typeof test === "string") {
345 return str.startsWith(test);
346 } else if (typeof test === "function") {
347 return test(str);
348 }
349
350 return test.some((test) => matchPart(str, test));
351};
352
353ModuleFilenameHelpers.matchPart = matchPart;
354

Callers

nothing calls this directly

Calls 2

testFunction · 0.50
testMethod · 0.45

Tested by

no test coverage detected