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

    Function isLeaf

    • True if the zipper is currently focused on a leaf.

      Type Parameters

      • A

        Underlying tree type.

      Parameters

      Returns boolean

      True if zipper is at leaf else false.

      import {Zipper, from, of} from 'effect-tree'

      const tree = from(1, of(2), of(3))

      const zipper = Zipper.fromTree(tree)

      expect(Zipper.isLeaf(zipper)).toBe(false)

      const moved = Zipper.head(zipper)

      expect(Zipper.isLeaf(moved)).toBe(true)