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

    Function append

    Append the given node as the last child of the given focus.

    At the key move you will find a version where the focus has been moved to the newly appended node.

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

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

    const changed = pipe(
    tree,
    Zipper.fromTree,
    Zipper.append(of(3)),
    Zipper.toTree,
    )

    expect(changed, 'changed').toEqual(from(1, of(2), of(3)))

    // This time we move to the newly appended tree
    const moved = pipe(
    tree,
    Zipper.fromTree,
    Zipper.append.move(of(3)),
    )

    expect(Zipper.getValue(moved), 'moved').toBe(3)

    The underlying type of the tree.

    A function that takes a zipper and returns an updated zipper where the focus node has been replaced.

    Index

    Properties

    Properties

    move: <A>(newNode: Tree<A>) => EndoOf<Zipper.Zipper<A>>