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

    Function isLeaf

    • Type guard for the tree Leaf type.

      Type Parameters

      • A

        Underlying tree type.

      Parameters

      Returns self is Leaf<A>

      import * as Tree from 'effect-tree'

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

      expect(Tree.isLeaf(leaf), 'branch').toBe(true)
      expect(Tree.isLeaf(branch), 'branch').toBe(false)