* Given a path, check if the file exists with any of the set extensions. * @param {string} basePath The path and filename without extension * @param {string[]} exts The extensions to try * @param {boolean} isMain Whether the module is the main module * @returns {string|false}
(basePath, exts, isMain)
| 605 | * @returns {string|false} |
| 606 | */ |
| 607 | function tryExtensions(basePath, exts, isMain) { |
| 608 | for (let i = 0; i < exts.length; i++) { |
| 609 | const filename = tryFile(basePath + exts[i], isMain); |
| 610 | |
| 611 | if (filename) { |
| 612 | return filename; |
| 613 | } |
| 614 | } |
| 615 | return false; |
| 616 | } |
| 617 | |
| 618 | /** |
| 619 | * Find the longest (possibly multi-dot) extension registered in `Module._extensions`. |
no test coverage detected
searching dependent graphs…