@@ -43,19 +43,20 @@ const tree = array2tree(tree2array([/* tree */]))
4343
4444## api
4545
46- | function | return | description |
47- | ----------------------------------------- | ------ | ------------------------------------------------------------------- |
48- | ` randomId(prefix = '') ` | string | generate random id with prefix, like ` i_9fang05da21 ` |
49- | ` array2tree(array, [options]) ` | array | array to tree with leaf and deep |
50- | ` arrayTrace(array, id, [options]) ` | array | trace source of id from array |
51- | ` arrayDeep(array, [options], [deep = 1]) ` | int | get max deep of array |
52- | ` arrayNode(array, id, [options]) ` | array | get path of id from array by id, like ` [id1, id12, id121] ` |
53- | ` tree2array(tree, [options]) ` | array | tree to array and generate id, parentId and leaf when undefined |
54- | ` treeFilter(tree, condition, [options]) ` | array | get new tree filter by condition function like ` node => !node.hide ` |
55- | ` treeDeep(tree, [options], [deep = 1]) ` | int | get max deep of tree |
56- | ` treeNode(tree, id, [options]) ` | array | get path of id from tree by id, like ` [id1, id12, id121] ` |
57- | ` treePath(tree, id, [options]) ` | array | get path of index from tree by id, like ` [0, 2, 1] ` |
58- | ` treeSub(tree, id, [options]) ` | object | get sub tree by id, like ` { id, parentId, children: [] } ` |
46+ | function | return | description |
47+ | ----------------------------------------- | ------ | --------------------------------------------------------------------------------- |
48+ | ` randomId(prefix = '') ` | string | generate random id with prefix, like ` i_9fang05da21 ` |
49+ | ` array2tree(array, [options]) ` | array | array to tree with leaf and deep |
50+ | ` arrayDeep(array, [options], [deep = 1]) ` | int | get max deep of array |
51+ | ` arrayTrace(array, id, [options]) ` | array | trace source of node by id from array, like ` [object1, object12, object121] ` |
52+ | ` arrayNode(array, id, [options]) ` | array | get path of id from array by id, like ` [id1, id12, id121] ` |
53+ | ` tree2array(tree, [options]) ` | array | tree to array and generate id, parentId and leaf when undefined |
54+ | ` treeDeep(tree, [options], [deep = 1]) ` | int | get max deep of tree |
55+ | ` treeFilter(tree, condition, [options]) ` | array | get new tree filter by condition function like ` node => !node.hide ` |
56+ | ` treePath(tree, id, [options]) ` | array | get path of index from tree by id, like ` [0, 2, 1] ` |
57+ | ` treeNode(tree, id, [options]) ` | array | get path of id from tree by id, like ` [id1, id12, id121] ` |
58+ | ` treeTrace(tree, id, [options]) ` | array | get path of node as object from tree by id, like ` [object1, object12, object121] ` |
59+ | ` treeSub(tree, id, [options]) ` | object | get sub tree by id, like ` { id, parentId, children: [] } ` |
5960
6061## options
6162
0 commit comments