Function reduce

  • Recursively reduce a tree to a single value in a depth-first traversal.

    Parameters

    • node: Node

      The node to start from

    • callback: Function

      Takes in the current accumulator and node and returns the new accumulator

    • initialValue: any

      The initial value of the accumulator

    Returns any

    the reduced value after visiting all nodes

Generated using TypeDoc