@eljs/utils
Version:
Collection of nodejs utility.
32 lines • 904 B
TypeScript
import { type Options } from 'ejs';
import { type OpeningAndClosingTags, type PartialsOrLookupFn, type RenderOptions } from 'mustache';
/**
* 模版渲染选项
*/
export type RenderTemplateOptions = MustacheRenderTemplateOptions | EjsRenderTemplateOptions;
/**
* mustache 模版渲染选项
*/
export interface MustacheRenderTemplateOptions {
/**
* 模版渲染器类型
*/
type?: 'mustache';
partials?: PartialsOrLookupFn;
tagsOrOptions?: OpeningAndClosingTags | RenderOptions;
}
/**
* ejs 模版渲染选项
*/
export interface EjsRenderTemplateOptions {
type?: 'ejs';
options?: Options;
}
/**
* 渲染模版
* @param template 模版内容
* @param data 模版数据
* @param options 选项
*/
export declare function renderTemplate(template: string, data: Record<string, any>, options?: RenderTemplateOptions): string;
//# sourceMappingURL=render.d.ts.map