该函数递归遍历树形结构,返回一个不超过指定深度的新树。 / This function recursively traverses a tree structure and returns a new tree with depth not exceeding the specified maximum.
Type Parameters
TextendsRecord<string,any>
树节点的类型,必须是一个对象 / The type of tree node, must be an object
根据最大深度获取子树 / Get subtree by maximum depth
该函数递归遍历树形结构,返回一个不超过指定深度的新树。 / This function recursively traverses a tree structure and returns a new tree with depth not exceeding the specified maximum.