declapract
Version:
A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.
21 lines • 873 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.readYmlFile = void 0;
const yaml_1 = __importDefault(require("yaml"));
const readFileAsync_1 = require("./readFileAsync");
const readYmlFile = async ({ filePath }) => {
// check path is for yml file
if (filePath.slice(-4) !== '.yml')
throw new Error(`file path point to a .yml file. error: ${filePath}`);
// get file contents
const stringContent = await (0, readFileAsync_1.readFileAsync)({ filePath });
// parse the string content into yml
const content = yaml_1.default.parse(stringContent);
// return the content
return content;
};
exports.readYmlFile = readYmlFile;
//# sourceMappingURL=readYmlFile.js.map