Skip to content

Function: pruneEmptyChildren() ​

ts
function pruneEmptyChildren(tree): TreeNode[];

删除树中每个节点的空 children 数组(原地修改)。

Parameters ​

ParameterType
treeTreeNode[]

Returns ​

TreeNode[]

Example ​

ts
pruneEmptyChildren([{ id: 1, children: [] }])
// => [{ id: 1 }] *

Since ​

1.0.0

Released under the MIT License.