A Nationwide transactions table parser.
npm install nationwide
Documentation and more detailed examples are hosted on Github Pages.
Copy the Nationwide statement table from the browser:
nationwide.html
<table>
<tbody>
<tr>
<td>
01 May 2023
<div style="display: none">- 1</div>
</td>
<td>Visa purchase</td>
<td>UBER *TRIP HELP.UBER.COM GB</td>
<td class="currency">£5.00</td>
<td class="currency"></td>
<td class="amountCell currency">£55.00</td>
</tr>
<tr>
<td>
02 May 2023
<div style="display: none">- 2</div>
</td>
<td>Visa purchase</td>
<td>UBER *TRIP HELP.UBER.COM GB</td>
<td class="currency">£5.00</td>
<td class="currency"></td>
<td class="amountCell currency">£50.00</td>
</tr>
<tr>
<td>
03 May 2023
<div style="display: none">- 3</div>
</td>
<td>Visa purchase</td>
<td>UBER *TRIP HELP.UBER.COM FR</td>
<td class="currency">£20.00</td>
<td class="currency"></td>
<td class="amountCell currency">£30.00</td>
</tr>
</tbody>
</table>
Parse the table:
import fs from "fs";
import path from "path";
import { Transaction } from "./Transaction";
const transactions = Transaction.table(fs.readFileSync(path.join(__dirname, "nationwide.html"), "utf8"));
[
{
"date": "2023-01-01",
"type": "Visa purchase",
"account": "UBER *TRIP HELP.UBER.COM GB",
"change": -5,
"balance": 55
},
{
"date": "2023-01-02",
"type": "Visa purchase",
"account": "UBER *TRIP HELP.UBER.COM GB",
"change": -5,
"balance": 50
},
{
"date": "2023-01-03",
"type": "Visa purchase",
"account": "UBER *TRIP HELP.UBER.COM FR",
"change": -20,
"balance": 30
}
]
Collate the transactions:
Transaction.collate(transactions);
{
"UBER *TRIP HELP.UBER.COM FR": -20,
"UBER *TRIP HELP.UBER.COM GB": -10
}
To install dependencies:
yarn install
To run tests:
yarn test
To generate the documentation locally:
yarn docs
To run linters:
yarn lint
To run formatters:
yarn format
Please read this repository's Code of Conduct which outlines our collaboration standards and the Changelog for details on breaking changes that have been made.
This repository adheres to semantic versioning standards. For more information on semantic versioning visit SemVer.
Bump2version is used to version and tag changes. For example:
bump2version patch
Lots of love to the open source community!