@carlosv2/glue
Version:
Dependency injection library that stays out of the way
26 lines (25 loc) • 705 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.YamlLoader = void 0;
const js_yaml_1 = require("js-yaml");
const loader_1 = require("../loader");
const format_1 = require("../../error/format");
class YamlLoader extends loader_1.Loader {
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.YamlLoader = YamlLoader;