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

    Function hasLefts

    • True if there are trees to the left of the focus, false if focused node is head in its forest.

      Type Parameters

      • A

        Underlying tree type.

      Parameters

      Returns boolean

      True if there are trees to the left of the focus.

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

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

      const zipper = pipe(
      tree,
      Zipper.fromTree,
      Zipper.head
      )

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

      const moved = Zipper.next(zipper)

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