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

    Function removeForest

    • Strip a branch from its children and return the new leaf.

      Type Parameters

      • A

        Tree underlying type.

      Parameters

      • self: Branch<A>

        The tree from which all nodes will be removed.

      Returns Leaf<A>

      A leaf tree node.

      import * as Tree from 'effect-tree'

      const tree = Tree.branch(1, [Tree.of(2)])

      expect(Tree.removeForest(tree)).toEqual(Tree.of(1))