-
-
Save stephen-lazaro/d7bed172a69cab87943fc442da254ab4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getAggregates = report => { | |
// Announce… uh, a lot of goals | |
let sumOfBalance = 0; | |
let count = 0; | |
let sumOfInterest = 0; | |
let numberInRepayment = 0; | |
// …20 other declarations here… | |
let obscureCalculation = 0; | |
report.forEach(function (record) { | |
// A lot of updates? | |
sumOfBalance += record.balance; | |
count += 1; | |
sumOfInterest += record.interest; | |
numberInRepayment += record.inRepayment ? 1 : 0; | |
// .. 20 other calculations here… | |
obscureCalculation = insaneProcedure(obscureCalculation, record) | |
}); | |
// Return a huge object | |
return { | |
totalBalance: sumOfBalance, | |
// … 23 other keys here … | |
length: count | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment