UNPKG

longform-markdown-splitter

Version:

Splits and transforms markdown files from obsidian for usage in hugo.

41 lines (40 loc) 1.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MD_Mapper = void 0; var MD_Mapper = (function () { function MD_Mapper() { } MD_Mapper.prototype.addMapping = function (mapping) { this.mappings.push(mapping); }; MD_Mapper.prototype.addMappings = function (mappings) { this.mappings = mappings; }; MD_Mapper.prototype.do_mappings = function (source, target) { if (this.mappings != null || this.mappings != undefined) { if ((source != null || source != undefined) && (target != null || target != undefined)) { this.mappings.forEach(function (map) { map.mapping_items.forEach(function (mapping_item) { var props = { source: source, target: target, source_property_name: mapping_item.source_property_name, target_poperty_name: mapping_item.target_poperty_name, source_value: source[mapping_item.source_property_name], target_value: target[mapping_item.target_poperty_name] }; if (map.task !== undefined || map.task !== null) { target[mapping_item.target_poperty_name] = map.task.perform(props); } else { target[mapping_item.target_poperty_name] = props.source_value; } }); }); } } }; return MD_Mapper; }()); exports.MD_Mapper = MD_Mapper;