aba-generate
Advanced tools
Comparing version 1.0.2 to 1.0.3
17
index.js
@@ -16,4 +16,4 @@ const moment = require('moment'); | ||
const format = bsb => { | ||
const value = bsb.replace(/(\s|-)+/, ''); | ||
return `${value.slice(0, 3)}-${value.slice(3, 6)}`; | ||
const value = bsb.replace(/(\s|-)+/, '').trim(); | ||
return value ? `${value.slice(0, 3)}-${value.slice(3, 6)}` : ''; | ||
}; | ||
@@ -45,3 +45,3 @@ | ||
'%(bank)-3s', | ||
' ', | ||
' '.repeat(7), | ||
'%(user)-26s', | ||
@@ -52,3 +52,3 @@ '%(userNumber)06d', | ||
'%(time)4s', | ||
' ', | ||
' '.repeat(36), | ||
].join(''); | ||
@@ -59,9 +59,9 @@ | ||
'999-999', | ||
' ', | ||
' '.repeat(12), | ||
'%(net)010d', | ||
'%(credit)010d', | ||
'%(debit)010d', | ||
' ', | ||
' '.repeat(24), | ||
'%(length)06d', | ||
' ', | ||
' '.repeat(40), | ||
].join(''); | ||
@@ -80,2 +80,4 @@ | ||
bsb: format(transaction.bsb), | ||
account: transaction.account.trim(), | ||
traceBsb: format(transaction.traceBsb), | ||
taxAmount: toCents(transaction.taxAmount), | ||
@@ -96,2 +98,3 @@ }) | ||
date: time.format('DDMMYY'), | ||
bsb: format(header.bsb), | ||
time: header.time ? time.format('HHmm') : '', | ||
@@ -98,0 +101,0 @@ }); |
{ | ||
"name": "aba-generate", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "ABA file generation", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,9 +16,10 @@ const ABA = require('../index'); | ||
const aba = new ABA({ | ||
bsb: '123123', | ||
account: '', | ||
bank: '', | ||
user: '', | ||
bsb: '012-030', | ||
account: '111111111', | ||
bank: 'ANZ', | ||
user: 'A USERNAME', | ||
userNumber: 1234, | ||
description: 'Creditors', | ||
}); | ||
const transaction = { | ||
@@ -25,0 +26,0 @@ bsb: '061021', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158443
418