UNPKG

@carlosv2/glue

Version:

Dependency injection library that stays out of the way

25 lines (24 loc) 653 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.JsonLoader = void 0; const format_1 = require("../../error/format"); const loader_1 = require("../loader"); class JsonLoader extends loader_1.Loader { 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.JsonLoader = JsonLoader;