UNPKG

yaml-config-ts

Version:

Typescript library to get config from YAML file

60 lines 2.07 kB
/// <reference types="node" /> /** * Yaml config class definition */ export declare class yamlConfig { path: string; filesData: Map<string, string>; filesParsedData: Map<string, any>; filesEncoding: BufferEncoding; requiredSettings: string[]; config: object; configYaml: string; /** * Object constructor * @param path - path to the file or directory to load * @param encoding - encoding to use with file(s) beeing loaded */ constructor(path: string, encoding?: BufferEncoding); /** * Logs provided message to stderr * @param message - string * @returns N/a */ log(message: string): void; /** * Checks provided file extension and updated files data map * @param file - path to the file or directory to read config(s) from */ readFile(file: string): void; /** * Reads specified path and loads data from file or directory * Updates files data map with files content * @param N/a * @returns N/a */ readConfig(): void; /** * Parses files from files data array and updates parsed files map with YAML contents */ parseConfig(): void; /** * Makes merged object from parsed config files */ mergeConfig(): void; /** * Preform substitution for given string based on the object contents * Placeholder format: ${path.to.object.property} * @param mainObject - object to get placeholder values from * @param stringToProcess - string with placeholder to be processed * @returns {result: string | number | object, status: boolean} */ substituteString(mainObject: any, stringToProcess: string): any; /** * Process substitions in config object(s) * @param mainObject - Object containing values that should be used for substitution. Equal to config object in most cases * @param objectToProcess - Object to replace substitutions in */ substitute(mainObject?: any, objectToProcess?: any): any; } //# sourceMappingURL=index.d.ts.map