• Traverses an object tree and collects nodes based on specified criteria.

    This function performs a post-order depth-first search (DFS) traversal of an object tree. During the traversal, it collects nodes (objects) into a set, optionally excluding array nodes based on a parameter.

    Type Parameters

    • T extends object

      The type of the object to be traversed.

    • TExcludeArray extends boolean = false

      A boolean flag indicating whether array nodes should be excluded.

    Parameters

    • obj: T

      The root object of the tree to traverse.

    • Optional options: {
          excludeArrays?: TExcludeArray;
      } = {}

      Configuration options for the traversal.

      • Optional excludeArrays?: TExcludeArray

        When true, array nodes are excluded from the results.

    Returns TExcludeArray extends true
        ? ExtractObjectsDeep<T>[]
        : Flatten<T>[]

    An array of nodes from the object tree. The type of the array elements depends on whether array nodes are excluded: if true, it returns an array of non-array objects deep within the structure; if false, it returns an array of all nodes.

Generated using TypeDoc