Skip to content

Commit

Permalink
Merge fix for #2, release version 0.20
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed Jan 12, 2024
2 parents 14eb380 + 868468e commit abd8617
Show file tree
Hide file tree
Showing 6 changed files with 353 additions and 17 deletions.
14 changes: 0 additions & 14 deletions .circleci/config.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Run tests (Node.js)

on: [push]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: ['14.x', '16.x', '18.x']

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
3 changes: 2 additions & 1 deletion ofx.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ function sgml2Xml(sgml) {
.replace(/>\s+</g, '><') // remove whitespace inbetween tag close/open
.replace(/\s+</g, '<') // remove whitespace before a close tag
.replace(/>\s+/g, '>') // remove whitespace after a close tag
.replace(/<([A-Za-z0-9_]+)>([^<]+)<\/\1>/g, '<\$1>\$2') // remove closing tags if present. Example: <FOO>bar</FOO> becomes <FOO>bar for consistency, fixed in last step below.
.replace(/<([A-Z0-9_]*)+\.+([A-Z0-9_]*)>([^<]+)/g, '<\$1\$2>\$3' )
.replace(/<(\w+?)>([^<]+)/g, '<\$1>\$2</\$1>');
.replace(/<(\w+?)>([^<]+)/g, '<\$1>\$2</\$1>'); // Add closing tag wherever they seem to be missing: <FOO>bar becomes <FOO>bar</FOO>
}

/**
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ofx-js",
"description": "Parse OFX files using pure JavaScript.",
"version": "0.1.1",
"version": "0.2.0",
"homepage": "https://github.com/bradenmacdonald/ofx-js",
"contributors": [
{
Expand All @@ -21,7 +21,7 @@
"tape": "^4.6.3"
},
"dependencies": {
"xml2js": "^0.4.19"
"xml2js": "^0.6.2"
},
"main": "./ofx.js",
"directories": {},
Expand Down
310 changes: 310 additions & 0 deletions test/data/example2.ofx
Original file line number Diff line number Diff line change
@@ -0,0 +1,310 @@
OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE
<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>
<DTSERVER>*******
<LANGUAGE>FRA
<DTPROFUP>******
<DTACCTUP>******
</SONRS>
</SIGNONMSGSRSV1>
<BANKMSGSRSV1>
<STMTTRNRS>
<TRNUID>******
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>
<STMTRS>
<CURDEF>EUR
<BANKACCTFROM>
<BANKID>*****</BANKID>
<BRANCHID>*****</BRANCHID>
<ACCTID>*****</ACCTID>
<ACCTTYPE>CHECKING</ACCTTYPE>
</BANKACCTFROM>
<BANKTRANLIST>
<DTSTART>****
<DTEND>****
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>****
<TRNAMT>-45.54
<FITID>******
<CHECKNUM>*****
<NAME>FRAIS DE TUTELLE
<MEMO>*******
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>******
<TRNAMT>-90.00
<FITID>*****
<CHECKNUM>****
<NAME>ACHAT PRODUITS HYGIENE
<MEMO>******
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>****
<TRNAMT>-78.73
<FITID>*****
<CHECKNUM>*****
<NAME>APIVIA COURTAGE
<MEMO>********
</STMTTRN>
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>*****
<TRNAMT>+721.01
<FITID>*****
<CHECKNUM>*****
<NAME>EURO VIR CARSAT LANGUEDOC ROUSSI
<MEMO>******
</STMTTRN>
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>****
<TRNAMT>+130.83
<FITID>******
<CHECKNUM>*****
<NAME>EURO VIR CARSAT TI LR PREST
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>*****
<TRNAMT>+247.28
<FITID>****
<CHECKNUM>******
<NAME>EURO VIR CAF GARD
<MEMO>******
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>****
<TRNAMT>-37.00
<FITID>*****
<CHECKNUM>*****
<NAME>DIRECTION GENERALE DES
<MEMO>******
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>****
<TRNAMT>-122.00
<FITID>****
<CHECKNUM>*****
<NAME>CHEQUE
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>***
<TRNAMT>-448.00
<FITID>****
<CHECKNUM>***
<NAME>DIRECTION GENERALE DES
<MEMO>****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>***
<TRNAMT>-2199.50
<FITID>****
<CHECKNUM>*****
<NAME>EHPAD 092023
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>****
<TRNAMT>-3.00
<FITID>****
<CHECKNUM>****
<NAME>COTISATIONS BANCAIRES
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>*****
<TRNAMT>-21.41
<FITID>*****
<CHECKNUM>***
<NAME>DDFIP GARD
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>***
<TRNAMT>-44.50
<FITID>****
<CHECKNUM>****
<NAME>COTISATIONS BANCAIRES
<MEMO>****
</STMTTRN>
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>****
<TRNAMT>+23947.61
<FITID>****
<CHECKNUM>****
<NAME>VIR
<MEMO>****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>****
<TRNAMT>-45.54
<FITID>****
<CHECKNUM>****
<NAME>FRAIS DE TUTELLE
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>****
<TRNAMT>-122.00
<FITID>****
<CHECKNUM>*****
<NAME>CHEQUE
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>*****
<TRNAMT>-78.73
<FITID>*****
<CHECKNUM>****
<NAME>APIVIA COURTAGE
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>****
<TRNAMT>+721.01
<FITID>*****
<CHECKNUM>****
<NAME>EURO VIR CARSAT LANGUEDOC ROUSSI
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>*****
<TRNAMT>+130.83
<FITID>****
<CHECKNUM>*****
<NAME>EURO VIR CARSAT TI LR PREST
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>*****
<TRNAMT>+242.28
<FITID>*****
<CHECKNUM>*****
<NAME>EURO VIR CAF GARD
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>****
<TRNAMT>-3.00
<FITID>****
<CHECKNUM>*****
<NAME>COTISATIONS BANCAIRES
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>****
<TRNAMT>-2267.65
<FITID>****
<CHECKNUM>****
<NAME>****
<MEMO>****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>*****
<TRNAMT>-78.73
<FITID>****
<CHECKNUM>****
<NAME>****
<MEMO>****
</STMTTRN>
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>***
<TRNAMT>+637.88
<FITID>****
<CHECKNUM>****
<NAME>EURO VIR CARSAT LANGUEDOC ROUSSI
<MEMO>EURO ****
</STMTTRN>
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>****
<TRNAMT>+130.83
<FITID>****
<CHECKNUM>****
<NAME>EURO VIR CARSAT TI LR PREST
<MEMO>****
</STMTTRN>
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>***
<TRNAMT>+242.28
<FITID>****
<CHECKNUM>*****
<NAME>EURO VIR CAF GARD
<MEMO>*****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>***
<TRNAMT>-45.54
<FITID>****
<CHECKNUM>****
<NAME>FRAIS DE TUTELLE
<MEMO>****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>****
<TRNAMT>-3.00
<FITID>***
<CHECKNUM>****
<NAME>COTISATIONS BANCAIRES
<MEMO>****
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>***
<TRNAMT>-122.00
<FITID>***
<CHECKNUM>****
<NAME>SNC L ESCALE 30ST PRIVAT DES
<MEMO>*****
</STMTTRN>
</BANKTRANLIST>
<LEDGERBAL>
<BALAMT>+23757.44
<DTASOF>****
</LEDGERBAL>
</STMTRS>
</STMTTRNRS>
</BANKMSGSRSV1>
</OFX>
Loading

0 comments on commit abd8617

Please sign in to comment.