Skip to content

Home > sculp-js > flatTree

flatTree() function

Converts a tree structure into a flat array.

Signature:

typescript
export declare function flatTree(treeList: any[], options?: IFieldOptions): any[];

Parameters

Parameter

Type

Description

treeList

any[]

Tree structure array

options

IFieldOptions

(Optional) Customizes id field name, child element field name, parent element field name. Default: { keyField: 'key', childField: 'children', pidField: 'pid' }

Returns:

any[]

{any[]} Flat array

Released under the MIT License.