Skip to content

Commit

Permalink
Fix converter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dickwolff committed Feb 1, 2024
1 parent deea389 commit 8959c63
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import { Trading212Converter } from "./converters/trading212Converter";
import { SwissquoteConverter } from "./converters/swissquoteConverter";
import { FinpensionConverter } from "./converters/finpensionConverter";

export function createAndRunConverter(converterType: string, inputFilePath: string, outputFilePath, completionCallback: CallableFunction, errorCallback: CallableFunction) {
export function createAndRunConverter(converterType: string, inputFilePath: string, outputFilePath: string, completionCallback: CallableFunction, errorCallback: CallableFunction) {

const converterTypeLc = converterType.toLocaleLowerCase();

// Determine convertor type.
const converter = createConverter(converterTypeLc);

// Map the file to a Ghostfolio import.
converter.processFile(inputFilePath, (result: GhostfolioExport) => {
converter.readAndProcessFile(inputFilePath, (result: GhostfolioExport) => {

console.log("[i] Processing complete, writing to file..")

Expand All @@ -29,7 +29,7 @@ export function createAndRunConverter(converterType: string, inputFilePath: stri
console.log(`[i] Wrote data to '${outputFileName}.json'!`);

completionCallback();
});
}, (error) => errorCallback(error));
}

function createConverter(converterType: string): AbstractConverter {
Expand Down Expand Up @@ -71,7 +71,7 @@ function createConverter(converterType: string): AbstractConverter {
converter = new SchwabConverter();
break;
default:
throw new Error(`Unknown converter '${process.argv[2].toLocaleLowerCase()}' provided`);
throw new Error(`Unknown converter '${converterType}' provided`);
}

return converter;
Expand Down

0 comments on commit 8959c63

Please sign in to comment.