UNPKG

@carlosv2/glue

Version:

Dependency injection library that stays out of the way

26 lines (25 loc) 721 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.YamlCompiler = void 0; const js_yaml_1 = require("js-yaml"); const compiler_1 = require("../compiler"); const format_1 = require("../../error/format"); class YamlCompiler extends compiler_1.Compiler { serialise(path, data) { try { return (0, js_yaml_1.dump)(data); } catch (_a) { throw new format_1.SerialiseError('YAML', path); } } deserialise(path, data) { try { return (0, js_yaml_1.load)(data); } catch (_a) { throw new format_1.DeserialiseError('YAML', path); } } } exports.YamlCompiler = YamlCompiler;