effect-tree
    Preparing search index...

    Function cropDepth

    • Crop all nodes from a tree that are deeper than the given depth. For example:

      import {leaf, branch, cropDepth} from 'effect-tree'

      // ┬1 A tree of depth=4
      // └┬2 with 3 branches and
      // └┬3 a single leaf.
      // └─4
      //
      const depth4: Tree<string> = branch(1, [branch(2, [branch(3, [leaf(4)])])]])

      const depth2: Tree<string> = pipe(depth4, cropDepth(2))
      //
      // ┬1 Has been cropped to a tree of depth=2
      // └─2 depth2 = branch(1, [leaf(2)])

      Parameters

      • depth: number

      Returns <A>(self: Tree<A>) => Tree<A>