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) 724 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const LoadFile_1 = require("../LoadFiles/LoadFile"); class SchemaLoader extends LoadFile_1.LoaderFile { constructor(pathSchemaIs) { super(pathSchemaIs); this.SCHEMA_FILE_NAME = 'schema.json'; this.path = this.getFullPathFile(pathSchemaIs); this.checkIfFileExist(); } getFullPathFile(pathSchemaIs) { return pathSchemaIs + '/' + this.SCHEMA_FILE_NAME; } checkIfFileExist() { if (!this.existPath()) { throw new Error('The schema file (' + this.SCHEMA_FILE_NAME + ') doesn\'t exist in folder.'); } } } exports.SchemaLoader = SchemaLoader;