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

    Function prepend

    Prepend a tree to the children of the root node. If self is a leaf, it is converted into a branch.

    import * as Tree from 'effect-tree'

    const tree = Tree.tree(1, [Tree.of(2), Tree.of(3)])
    const changed = Tree.prepend(tree, Tree.of(4))

    expect(Tree.getForest(changed)).toEqual([
    Tree.of(4),
    Tree.of(2),
    Tree.of(3),
    ])

    Tree underlying type.

    The tree to modify.

    Child to prepend.

    A new updated tree with the new node prepended.