nested_json_to_csv
Version:
24 lines (23 loc) • 875 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParserFactory = void 0;
const CsvParserService_1 = require("../services/CsvParserService");
const JsonParserService_1 = require("../services/JsonParserService");
class ParserFactory {
make(className, ...args) {
try {
if (className == "jsonParser") {
return new JsonParserService_1.JsonParserService(args[0], args[1]);
}
if (className == "csvParser") {
return new CsvParserService_1.CsvParserService(args[0]);
}
//TODO: add NULL desgin pattern here
}
catch (error) {
console.log(error);
throw new Error("Something broke in the facotry please make sure you are passing the right paramers");
}
}
}
exports.ParserFactory = ParserFactory;