mirror of
https://github.com/kmitresse/Compo-Service-Log-Project.git
synced 2026-05-13 17:11:49 +00:00
17 lines
474 B
TypeScript
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;
|