UNPKG

docparse-dumpinvoices

Version:

takes a list of couchdb invoice ids and exports the data contained within those invoices to an Excel spreadsheet

12 lines (11 loc) 367 B
var num = require('num') var isLatePaymentChargeCost = require('./isLatePaymentChargeCost') module.exports = function (costs) { var latePaymentChargesCosts = costs.filter(function (cost) { return isLatePaymentChargeCost(cost) }) var total = latePaymentChargesCosts.reduce(function (a, b) { return a.add(b.value) }, num(0)).toString() return total }