UNPKG

@ng-doc/builder

Version:

<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>

25 lines 891 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.findClosestFile = findClosestFile; const tslib_1 = require("tslib"); const path = tslib_1.__importStar(require("path")); /** * Finds the closest file in the given path. * @param tree * @param {string} currentFolder The current folder to search in. * @param {string} fileName The file name to search for. * @returns {string} The path to the closest file. */ function findClosestFile(tree, currentFolder, fileName) { const currentPath = currentFolder; const filePath = path.join(currentPath, fileName); if (tree.get(filePath)) { return filePath; } const parentPath = path.dirname(currentPath); if (['/', '.', ''].includes(parentPath)) { return null; } return findClosestFile(tree, parentPath, fileName); } //# sourceMappingURL=find-closest-file.js.map