npm package: @lukadimjasevic/bank-statement-parser
Description: A Node.js package for parsing bank statement exports into a unified JSON format. It simplifies working with financial transaction data by providing a consistent structure ready for analysis, reporting, or automation.
Author: Luka Dimjašević
Latest version: 1.0.1

# bank-statement-parser

A Node.js package for parsing bank statement exports into a unified JSON format. It simplifies working with financial transaction data by providing a consistent structure ready for analysis, reporting, or automation. 

## Disclaimer

This package is not affiliated with, endorsed, or sponsored by Revolut Ltd or Zagrebačka banka d.d.
The use of the names "Revolut" and "Zagrebačka banka" is for descriptive purposes only, to indicate that this package works with export statements generated by accounts at these banks.

## Installation

```bash
npm install @lukadimjasevic/bank-statement-parser
```

## Usage
Basic usage
```js
const { StatementParser } = require('@lukadimjasevic/bank-statement-parser');
const filePath = '<path-to-statement>.xlsx';

// Initialize the parser for a specific bank
const parser = new StatementParser(filePath, { bank: 'revolut' });
// or for ZABA:
// const parser = new StatementParser(filePath, { bank: 'zaba' });

// Parse transactions from the statement
const transactions = parser.parse();

// Output normalized transactions
console.log(transactions);
```
## Transaction Object

Each transaction returned by the parser has the following fields:

| Column            | Type    | Description                                                |
|-------------------|---------|------------------------------------------------------------|
| type              | string  | Type of transaction (Deposit or Withdrawal)                |
| product           | string  | Account type                                               |
| startedDate       | Date    | Date when the transaction started                          |
| completedDate     | Date    | Date when the transaction completed                        |
| description       | string  | Transaction description                                    |
| amount            | number  | Transaction amount                                         |
| fee               | number  | Transaction fee                                            |
| currency          | string  | Transaction currency                                       |
| balance           | number  | Account balance after the transaction                      |
| hash              | string  | Optional unique transaction hash (`setHash: true`)         |

## Options

| Option          | Type            | Description                                                                                    |
| --------------- | --------------- | ---------------------------------------------------------------------------------------------- |
| bank            | string          | Specifies which bank’s statement format to parse. Currently supported banks: 'revolut', 'zaba' |
| setHash         | boolean         | Generate a unique hash for each transaction                                                    |
| includeColumns  | array           | Only include specified columns in output                                                       |