solidity-docgen
Version:
Documentation generator for Solidity smart contracts.
31 lines • 905 B
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.findIn = exports.findExists = exports.exists = void 0;
const fs_1 = require("fs");
const path_1 = __importDefault(require("path"));
async function exists(path, mode = fs_1.constants.R_OK) {
try {
await fs_1.promises.access(path, mode);
return true;
}
catch {
return false;
}
}
exports.exists = exists;
async function findExists(...paths) {
for (const p of paths) {
if (await exists(p)) {
return p;
}
}
}
exports.findExists = findExists;
async function findIn(f, dirs) {
return findExists(...dirs.map(d => path_1.default.resolve(d, f)));
}
exports.findIn = findIn;
//# sourceMappingURL=fs-exists.js.map
;