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

    Function length

    • Return direct child count for root node of given tree.

      See nodeCount for a version that count all nodes and not just direct children.

      Type Parameters

      • A

        Underlying tree type.

      Parameters

      • self: Tree<A>

        The tree being queried.

      Returns number

      Numeric child count.

      import * as Tree from 'effect-tree'

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

      expect(Tree.length(tree)).toBe(2)