UNPKG

@smooai/utils

Version:

A collection of shared utilities and tools used across SmooAI projects. This package provides common functionality to standardize and simplify development across all SmooAI repositories.

34 lines (33 loc) 1.22 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const require_chunk = require("../chunk-CoPdw6nB.cjs"); let find_up = require("find-up"); let _smooai_logger_Logger = require("@smooai/logger/Logger"); _smooai_logger_Logger = require_chunk.__toESM(_smooai_logger_Logger); //#region src/file/findFile.ts const logger = new _smooai_logger_Logger.default({ name: "findFile" }); const findFile = async (filename, options) => { const logError = options?.logError ?? true; try { const foundPath = await (0, find_up.findUp)(filename); if (!foundPath) throw new Error(`Unable to find ${filename}`); return foundPath; } catch (error) { if (logError) logger.error(error, `Error finding file '${filename}`); throw error; } }; const findFileSync = (filename, options) => { const logError = options?.logError ?? true; try { const foundPath = (0, find_up.findUpSync)(filename); if (!foundPath) throw new Error(`Unable to find ${filename}`); return foundPath; } catch (error) { if (logError) logger.error(error, `Error finding file '${filename}`); throw error; } }; //#endregion exports.findFile = findFile; exports.findFileSync = findFileSync; //# sourceMappingURL=findFile.cjs.map