Function depthTraverse

  • Performs a naive depth traversal of an object / array. The data structure must not have circular references. The result of the callback function is used to modify in place the given data.

    Parameters

    • data: object | []

      An object or array.

    • func: Function

      A callback function to process leaf values in children arrays or object members.

    • Optionalmodify: boolean

      If true then the result of the callback function is used to modify in place the given data.

    Returns object | []

    The data object.