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 isLatePaymentCreditCost = require('./isLatePaymentCreditCost') module.exports = function (costs) { var latePaymentCreditsCosts = costs.filter(function (cost) { return isLatePaymentCreditCost(cost) }) var total = latePaymentCreditsCosts.reduce(function (a, b) { return a.add(b.value) }, num(0)).toString() return total }