Skip to content

Instantly share code, notes, and snippets.

@stephen-lazaro
Created October 4, 2018 17:58
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/076e77351b60fe3ec53151166adfb42c to your computer and use it in GitHub Desktop.
Save stephen-lazaro/076e77351b60fe3ec53151166adfb42c to your computer and use it in GitHub Desktop.
// Sum the balances _object by object_
const sumBalances = (prior, record) =>
  prior + record.balance;
// Sum all the balances one by one by using our object by object definition
const getSumOfBalance = report =>
  report.reduce(sumBalances, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment