noodl-loader
Version:
Loader for noodl applications
41 lines • 2.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getKeys = exports.toDocument = exports.toYAML = exports.visit = exports.parseDocument = exports.parse = exports.isSeq = exports.isMap = exports.isPair = exports.isScalar = exports.isDocument = exports.isNode = exports.YAMLSeq = exports.YAMLMap = exports.YAMLDocument = exports.Scalar = exports.Pair = void 0;
const noodl_core_1 = require("noodl-core");
const yaml_1 = require("yaml");
Object.defineProperty(exports, "YAMLDocument", { enumerable: true, get: function () { return yaml_1.Document; } });
Object.defineProperty(exports, "Pair", { enumerable: true, get: function () { return yaml_1.Pair; } });
Object.defineProperty(exports, "Scalar", { enumerable: true, get: function () { return yaml_1.Scalar; } });
Object.defineProperty(exports, "YAMLMap", { enumerable: true, get: function () { return yaml_1.YAMLMap; } });
Object.defineProperty(exports, "YAMLSeq", { enumerable: true, get: function () { return yaml_1.YAMLSeq; } });
Object.defineProperty(exports, "isNode", { enumerable: true, get: function () { return yaml_1.isNode; } });
Object.defineProperty(exports, "isDocument", { enumerable: true, get: function () { return yaml_1.isDocument; } });
Object.defineProperty(exports, "isScalar", { enumerable: true, get: function () { return yaml_1.isScalar; } });
Object.defineProperty(exports, "isPair", { enumerable: true, get: function () { return yaml_1.isPair; } });
Object.defineProperty(exports, "isMap", { enumerable: true, get: function () { return yaml_1.isMap; } });
Object.defineProperty(exports, "isSeq", { enumerable: true, get: function () { return yaml_1.isSeq; } });
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return yaml_1.parse; } });
Object.defineProperty(exports, "parseDocument", { enumerable: true, get: function () { return yaml_1.parseDocument; } });
Object.defineProperty(exports, "visit", { enumerable: true, get: function () { return yaml_1.visit; } });
function toYAML(value, options) {
return (0, yaml_1.parse)(value, Object.assign({ logLevel: 'warn', schema: 'core', version: '1.2' }, options));
}
exports.toYAML = toYAML;
function toDocument(value, options) {
return (0, yaml_1.parseDocument)(value, Object.assign({ logLevel: 'warn', schema: 'core', version: '1.2' }, options));
}
exports.toDocument = toDocument;
function getKeys(value) {
if (noodl_core_1.is.arr(value)) {
return value.map((val) => {
if ((0, yaml_1.isNode)(val)) {
if ((0, yaml_1.isScalar)(val))
return val.toString();
}
return val;
});
}
return [];
}
exports.getKeys = getKeys;
//# sourceMappingURL=yaml.js.map