(test, module)
| 599 | * @returns {boolean} true, if the module should be selected |
| 600 | */ |
| 601 | const checkModuleType = (test, module) => { |
| 602 | if (test === undefined) return true; |
| 603 | if (typeof test === "function") { |
| 604 | return test(module.type); |
| 605 | } |
| 606 | if (typeof test === "string") { |
| 607 | const type = module.type; |
| 608 | return test === type; |
| 609 | } |
| 610 | if (test instanceof RegExp) { |
| 611 | const type = module.type; |
| 612 | return test.test(type); |
| 613 | } |
| 614 | return false; |
| 615 | }; |
| 616 | |
| 617 | /** @typedef {(layer: string | null) => boolean} CheckModuleLayerFn */ |
| 618 |
no test coverage detected