Skip to content

Instantly share code, notes, and snippets.

@stephen-lazaro
Last active October 4, 2018 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephen-lazaro/3be56738a2634c045fcf4921947725b5 to your computer and use it in GitHub Desktop.
Save stephen-lazaro/3be56738a2634c045fcf4921947725b5 to your computer and use it in GitHub Desktop.
// Single aggregate, summing the balances of records
const getSumOfBalance = report =>
  // Run over the records
  report.reduce(
  // Adding the balance of each record to the total
  function (sum, record) {
  return sum + record.balance;
  },
  // Starting at 0
  0
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment