Files
Compo-Service-Log-Project/app/src/services/parser/ParserFactory.ts
T
2024-12-19 11:25:29 +01:00

17 lines
474 B
TypeScript

import { Parser, CsvParser } from "./index";
import { ParserType } from "./index";
class ParserFactory {
/**
* Get the parser corresponding to the dataset type
* @param fileType The type of the dataset
* @returns The parser corresponding to the dataset type
*/
static getParser(fileType: ParserType): Parser {
if (fileType === ParserType.CSV) return CsvParser.instance;
throw new Error("Unsupported file type");
}
}
export default ParserFactory;