UNPKG

curli-config

Version:

A small library to load/validate configuration files placed in different sides of the application using environments

21 lines (20 loc) 552 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const fs_1 = require("fs"); class LoaderFile { constructor(path) { this.path = path; } loadFile() { let fileContent = {}; if (this.existPath()) { const rawFileContent = fs_1.readFileSync(this.path, 'utf8'); fileContent = JSON.parse(rawFileContent); } return fileContent; } existPath() { return fs_1.existsSync(this.path); } } exports.LoaderFile = LoaderFile;