UNPKG

devui-admin-test

Version:

Schematics for ng-devui-admin

26 lines 769 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.writeJson = exports.readJson = void 0; function readJson(tree, file, type) { if (!tree.exists(file)) { return null; } const sourceFile = tree.read(file).toString('utf-8'); try { const json = JSON.parse(sourceFile); if (type && !json[type]) { json[type] = {}; } return json; } catch (error) { console.log(`Failed when parsing file ${file}.`); throw error; } } exports.readJson = readJson; function writeJson(tree, file, source) { tree.overwrite(file, JSON.stringify(source, null, 2)); } exports.writeJson = writeJson; //# sourceMappingURL=json-operation.js.map