(str, test)
| 338 | * ``` |
| 339 | */ |
| 340 | const 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 | |
| 353 | ModuleFilenameHelpers.matchPart = matchPart; |
| 354 |