sls-dev-tools
Version:
The Dev Tools for the Serverless World
40 lines (30 loc) • 746 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const yaml = require("js-yaml");
class CustomTag {
constructor(type, data) {
this.type = type;
this.data = data;
}
}
const tags = ["scalar", "sequence", "mapping"].map(kind => // first argument here is a prefix, so this type will handle anything starting with !
new yaml.Type("!", {
kind,
multi: true,
representName(object) {
return object.type;
},
represent(object) {
return object.data;
},
instanceOf: CustomTag,
construct(data, type) {
return new CustomTag(type, data);
}
}));
const YAML_SCHEMA = yaml.DEFAULT_SCHEMA.extend(tags);
var _default = YAML_SCHEMA;
exports.default = _default;