Skip to content

@vtj


@vtj / base / arrayToTree

Function: arrayToTree()

arrayToTree<T>(array, id, parentId, children, root): T[]

数组转换为树结构

Type Parameters

T extends Record<string, any>

Parameters

array

T[]

id

keyof T = 'id'

parentId

keyof T = 'parentId'

children

string = 'children'

root

string | number

Returns

T[]

Defined in

packages/base/src/data.ts:244

Released under the MIT License.