Nationwide
A Nationwide transactions table parser.
Status
Source | Shields |
---|
Project | |
Health | |
Publishers | |
Repository | |
Activity | |
Installation
npm i nationwide
Usage
Copy the Nationwide statement table from the browser:
nationwide.html
<table>
<tbody>
<tr>
<td>
01 May 2021
<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 2021
<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 2021
<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.resolve(__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
}
Tests
To run tests:
nps test
Documentation
This repository's documentation is hosted on Read the Docs.
To generate the documentation locally:
quickdocs
Linters
To run linters:
nps lint
Formatters
To run formatters:
nps format
Continuous integration
This repository uses GitHub Actions to lint and test each commit. Each commit should be formatted and its corresponding documentation should be updated.
Versioning
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
Changelog
Please read this repository's changelog for details on changes that have been made.
Contributing
Please read this repository's guidelines on contributing for details on the process for submitting pull requests. Moreover, our code of conduct declares our collaboration standards.
Contributors
Lots of love to the open source community!