@rx-angular/template
Version:
**Fully** Reactive Component Template Rendering in Angular. @rx-angular/template aims to be a reflection of Angular's built in renderings just reactive.
20 lines (19 loc) • 567 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.readJsonInTree = readJsonInTree;
function readJsonInTree(host, path) {
if (!host.exists(path)) {
throw new Error(`Cannot find ${path}`);
}
const buffer = host.read(path);
if (buffer != null) {
const contents = buffer.toString('utf-8');
try {
return JSON.parse(contents);
}
catch (e) {
throw new Error(`Cannot parse ${path}: ${e.message}`);
}
}
throw new Error(`cannot read ${path}`);
}