UNPKG

declapract

Version:

A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.

12 lines 664 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.readFileIfExistsAsync = void 0; const doesFileExist_1 = require("./doesFileExist"); const readFileAsync_1 = require("./readFileAsync"); const readFileIfExistsAsync = async ({ filePath, }) => { const fileExists = await (0, doesFileExist_1.doesFileExist)({ filePath }); const fileContents = fileExists ? await (0, readFileAsync_1.readFileAsync)({ filePath }) : null; // if file does not exist, we know contents are non existent (i.e., null) return fileContents; }; exports.readFileIfExistsAsync = readFileIfExistsAsync; //# sourceMappingURL=readFileIfExistsAsync.js.map