UNPKG

md-curcuma

Version:

A Typescript library for transporting and converting markdown and other data.

28 lines (27 loc) 654 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MD_Template = void 0; const fs = require("fs"); class MD_Template { constructor(template) { this.template = ""; this.template = template; } load(path) { try { this.template = fs.readFileSync(path).toString(); } catch (err) { throw err; } } fill(values) { return this.template.replace(/\{(\w+)\}/g, function (_, key) { return values[key]; }); } get_template_string() { return this.template; } } exports.MD_Template = MD_Template;