File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
2- var util = require ( 'util' ) ;
32
43var exists = function ( obj , key ) {
54 return obj != null && Object . hasOwnProperty . call ( obj , key ) ;
65} ;
76
7+ var extend = function ( destination , source ) {
8+ for ( var property in source ) {
9+ destination [ property ] = source [ property ] ;
10+ }
11+ return destination ;
12+ }
13+
14+ var isArray = Array . isArray || function ( obj ) {
15+ return toString . call ( obj ) === '[object Array]' ;
16+ } ;
17+
818var createTree = function ( array , rootNodes , customID ) {
919 var tree = [ ] ;
1020
@@ -58,7 +68,7 @@ var groupByParents = function(array, options) {
5868 */
5969
6070module . exports = function arrayToTree ( options ) {
61- options = util . _extend ( {
71+ options = extend ( {
6272 parentProperty : 'parent_id' ,
6373 data : [ ] ,
6474 customID : 'id' ,
@@ -67,7 +77,7 @@ module.exports = function arrayToTree(options) {
6777
6878 var data = options . data ;
6979
70- if ( ! util . isArray ( data ) ) {
80+ if ( ! isArray ( data ) ) {
7181 throw new Error ( 'Expected an object but got an invalid argument' ) ;
7282 }
7383
You can’t perform that action at this time.
0 commit comments