-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.js
26 lines (23 loc) · 941 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var Statement = require('./statement')
module.exports = {
testStatementDefinition: function (definition) {
try {
var statement = new Statement(definition)
var transactions = statement.transactions
var label = 'transaction' + (transactions.length === 1 ? '' : 's')
var separator = '=============================================='
console.log(separator)
console.log('Boiler: ' + statement.name())
console.log(transactions.length + ' ' + label + ' parsed')
if (statement.transactions.length > 1) {
console.log('First transaction:', transactions.first().toJSON())
console.log('Last transaction:', transactions.last().toJSON())
} else if (statement.transactions.length) {
console.log('Transaction:', transactions.first())
}
console.log(separator)
} catch (error) {
console.log('Could not create Statement: ' + error.message)
}
}
}