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.
move
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 treeconst moved = pipe( tree, Zipper.fromTree, Zipper.append.move(of(3)),)expect(Zipper.getValue(moved), 'moved').toBe(3) Copy
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 treeconst 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.
Append the given node as the last child of the given focus.
At the key
moveyou will find a version where the focus has been moved to the newly appended node.Example
Type Param: A
The underlying type of the tree.
Returns
A function that takes a zipper and returns an updated zipper where the focus node has been replaced.