From 8710acf93fe9a18974667587aead1189495ab87f Mon Sep 17 00:00:00 2001 From: JulienBrks Date: Sun, 17 Mar 2019 14:23:21 +0800 Subject: [PATCH] fix:hasOwnProperty check error --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index bf98674..6d72870 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ function createTree(array, rootNodes, customID, childrenProperty) { var node = rootNodes[rootNode]; var childNode = array[node[customID]]; - if (!node && !rootNodes.hasOwnProperty(rootNode)) { + if (!node || !rootNodes.hasOwnProperty(rootNode)) { continue; }