(test, module, context)
| 574 | * @returns {boolean} true, if the module should be selected |
| 575 | */ |
| 576 | const 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 |
no test coverage detected