File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -29,3 +29,17 @@ fetch('https://raw.githubusercontent.com/internet5/smart-array-to-tree/master/ex
29
29
// 2017-11-21T09:51:37.930Z
30
30
// 2017-11-21T09:51:37.979Z
31
31
```
32
+ ## API
33
+ ### ` smartArrayToTree(data, [options]) `
34
+ Convert a plain array of nodes (with pointers to parent nodes) to a a nested data structure.
35
+
36
+ #### Parameters
37
+ - ** Array** ` data ` : An array of data
38
+ - ** Object** ` options ` : An object containing the following fields:
39
+ - ` id ` (String): An unique node identifier. Default: 'id'
40
+ - ` pid ` (String): A name of a property where a link to a parent node could be found. Default: 'pid'
41
+ - ` children ` (String): The child node name that you want. Default: 'children'
42
+ - ` firstPid ` (String): The parent id of fisrt level node . Default: null
43
+
44
+ #### Return
45
+ - ** Array** : Result of transformation
You can’t perform that action at this time.
0 commit comments