File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ function orderByParents(list, config) {
4545 *
4646 * - `parentProperty` (String): A name of a property where a link to
4747 * a parent node could be found. Default: 'parent_id'
48- * - `data` (Array): An array with data
48+ * - `data` (Array): An array of data
4949 * - `customID` (String): An unique node identifier. Default: 'id'
5050 *
5151 * @return {Array } Result of transformation
Original file line number Diff line number Diff line change @@ -33,8 +33,6 @@ var navigation = [{
3333 parent_id: null
3434}];
3535
36- var navigationTree = arrayToTree ({ data: navigation });
37-
3836/*
3937 * Output:
4038 * Portfolio
@@ -43,9 +41,23 @@ var navigationTree = arrayToTree({ data: navigation });
4341 * About Me
4442 */
4543
44+ var navigationTree = arrayToTree ({ data: navigation });
4645```
4746
47+ ## Documentation
48+
49+ ### ` arrayToTree(options) `
50+ Convert a plain array of nodes (with pointers to parent nodes) to a tree.
51+
52+ #### Params
53+ ** Object** ` options ` : An object containing the following fields:
54+ - ` parentProperty ` (String): A name of a property where a link to a parent node could be found. Default: 'parent_id'
55+ - ` data ` (Array): An array of` data
56+ - ` customID ` (String): An unique node identifier. Default: 'id'
57+
58+ #### Return
59+ - ** Array** : Result of transformation
60+
4861## License
4962
50- MIT
51- [ Philipp Alferov] ( https://github.com/alferov )
63+ MIT © [ Philipp Alferov] ( https://github.com/alferov )
You can’t perform that action at this time.
0 commit comments