mirror of
https://github.com/dadosfera/maestro.git
synced 2026-08-31 19:58:21 +00:00
26 lines
810 B
TypeScript
26 lines
810 B
TypeScript
import { TypeParser } from './parser-types';
|
|
import { HtmlParser } from './html-parser';
|
|
import { CsvParser } from './csv-parser';
|
|
import { PDFParser } from './pdf-parser';
|
|
import { Parser } from './parser.interface';
|
|
|
|
export class ParserBuilder {
|
|
static build<T>(type: TypeParser): Parser<T> {
|
|
const templatePath = '/app/dist/assets/template/pii-reporter.html';
|
|
|
|
if (type === 'html') {
|
|
const htmlParser = new HtmlParser<T>(templatePath);
|
|
return htmlParser;
|
|
} else if (type === 'csv') {
|
|
const csvParser = new CsvParser<T>();
|
|
return csvParser;
|
|
} else if (type === 'pdf') {
|
|
const htmlParser = new HtmlParser<T>(templatePath);
|
|
const pdfParser = new PDFParser(htmlParser);
|
|
return pdfParser;
|
|
}
|
|
|
|
throw new Error('Unsupported Type: ' + type);
|
|
}
|
|
}
|