UNPKG

st-open-api

Version:

Generates API client SDKs from an OpenAPI specification written in OpenAPI version 3.x.x

22 lines 806 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.renderMustache = void 0; var path = require("path"); var Mustache = require("mustache"); var fs = require("fs"); var TYPE_TEMPLATE_DIR = path.join(__dirname, '..', 'template', 'mustache', 'ts'); var cache = {}; var renderMustache = function (templateName, viewData) { var templatePath = path.join(TYPE_TEMPLATE_DIR, templateName); var templateString; if (!!cache[templatePath]) { templateString = cache[templatePath]; } else { templateString = fs.readFileSync(templatePath).toString('utf8'); cache[templatePath] = templateString; } return Mustache.render(templateString, viewData); }; exports.renderMustache = renderMustache; //# sourceMappingURL=render-mustache.js.map