mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-03 13:14:48 +00:00
17 lines
416 B
TypeScript
17 lines
416 B
TypeScript
import { readFileSync } from 'fs';
|
|
import Handlebars from 'handlebars';
|
|
|
|
export class HtmlParser<T> {
|
|
constructor(private readonly templatePath: string) {}
|
|
parse(data: T[]) {
|
|
const templateSource = readFileSync(this.templatePath, 'utf8');
|
|
|
|
const template = Handlebars.compile(templateSource);
|
|
|
|
return template({
|
|
dados: data,
|
|
dataGeracao: new Date().toLocaleString('pt-BR'),
|
|
});
|
|
}
|
|
}
|