Child pages
  • fluid.accumulate

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

fluid.accumulate(list, fn, arg)

Scans through a list of objects, "accumulating" a value over them (may be a straightforward "sum" or some other chained computation). The results will be added to the initial value passed in by "arg" and returned.

To a Google developer, this would be "reduce", from the "map/reduce" pairing.


  • list {Array}: The list of objects to be accumulated over
  • fn {Function}: An "accumulation function" accepting the signature (object, total, index) where object is the list member, total is the "running total" object (which is the return value form the previous function), and index is the index number.
  • arg {Object}: The initial value for the "running total" object

Return Value

Object: the modified "arg" object