@carlosv2/glue
Version:
Dependency injection library that stays out of the way
25 lines (24 loc) • 669 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonCompiler = void 0;
const format_1 = require("../../error/format");
const compiler_1 = require("../compiler");
class JsonCompiler extends compiler_1.Compiler {
serialise(path, data) {
try {
return JSON.stringify(data);
}
catch (_a) {
throw new format_1.SerialiseError('JSON', path);
}
}
deserialise(path, data) {
try {
return JSON.parse(data);
}
catch (_a) {
throw new format_1.DeserialiseError('JSON', path);
}
}
}
exports.JsonCompiler = JsonCompiler;