File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,23 @@ function orderByParents(list, config) {
3535 return parents ;
3636}
3737
38- module . exports = function ( options ) {
38+ /**
39+ * arrayToTree
40+ * Convert a plain array of nodes (with pointers to parent nodes) to a tree
41+ *
42+ * @name arrayToTree
43+ * @function
44+ * @param {Object } options An object containing the following fields:
45+ *
46+ * - `parentProperty` (String): A name of a property where a link to
47+ * a parent node could be found. Default: 'parent_id'
48+ * - `data` (Array): An array with data
49+ * - `customID` (String): An unique node identifier. Default: 'id'
50+ *
51+ * @return {Array } Result of transformation
52+ */
53+
54+ module . exports = function arrayToTree ( options ) {
3955 var config = util . _extend ( {
4056 parentProperty : 'parent_id' ,
4157 data : [ ] ,
You can’t perform that action at this time.
0 commit comments