UNPKG

@osmos/arraytotree

Version:

transform flat array to tree structure

12 lines (10 loc) 264 B
type TreeNodes = any[] & { findNodeById: (id: any) => any; }; declare function arrayToTree(nodes: any[], option: { idKey: string; parentKey: string; childrenKey: string; sortKey?: string; }): TreeNodes; export { type TreeNodes, arrayToTree };