Skip to content

Commit 0c37df9

Browse files
author
Philipp Alferov
committed
Prevent from mutating original data array
1 parent 5c3ddf2 commit 0c37df9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module.exports = function arrayToTree(data, options) {
8383
throw new TypeError('Expected an object but got an invalid argument');
8484
}
8585

86-
var grouped = groupByParents(data, options);
86+
var grouped = groupByParents(data.slice(), options);
8787
return createTree(
8888
grouped,
8989
grouped[options.rootID],

0 commit comments

Comments
 (0)