Skip to content

Commit

Permalink
fix(parser): filter out null transactions from hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsmaerten committed Apr 1, 2023
1 parent 77c7e8a commit 2486843
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lib/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ export function parseBankFile(source: BankFile, parsers: Parser[]) {
const endRow = records.length - parser.footer_rows;
records = records.slice(startRow, endRow).map(deduplicateColumns);

const transactions = records.map((record) => {
const tx = buildTransaction(record, parser);
return hooks.onTransaction(record, tx).filter((t) => t);
});
const transactions = records
.map((record) => {
const tx = buildTransaction(record, parser);
return hooks.onTransaction(record, tx);
})
.filter((tx) => tx);
logResult(transactions.length, source.path);
return {
transactions,
Expand Down

0 comments on commit 2486843

Please sign in to comment.