UNPKG

ivr-tester-cli

Version:

CLI for automated testing of IVR call flows

24 lines (23 loc) 730 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createJsonFileReader = void 0; function createJsonFileReader(fsReadFileSync) { return function (path) { let content; try { content = fsReadFileSync(path); } catch (error) { throw new Error(`Failed to read file '${path}'. Reason: ${error.message}`); } let jsonContent; try { jsonContent = JSON.parse(content.toString("utf-8")); } catch (error) { throw new Error(`File '${path}' not valid JSON. Reason: ${error.message}`); } return jsonContent; }; } exports.createJsonFileReader = createJsonFileReader;