effect-tree - v1.0.36
    Preparing search index...

    Function getForest

    • Get the forest of any tree node. Result could be an empty list if the given node is a Leaf.

      See getBranchForest for a version that returns the non-empty forest of a branch.

      Type Parameters

      • A

        Underlying tree type.

      Parameters

      • self: Tree<A>

        The tree being queried.

      Returns readonly Tree<A>[]

      A possibly empty list of trees.

      import * as Tree from 'effect-tree'

      const tree = Tree.tree(1, [Tree.leaf(2), Tree.leaf(3)])

      expect(Tree.getForest(tree)).toEqual([Tree.leaf(2), Tree.leaf(3)])