Created
November 18, 2015 17:01
-
-
Save pzzrudlf/e486152183d4b8226f11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //convert json to array | |
| function json2array(json){ | |
| var temp = []; | |
| var keys = Object.keys(json); | |
| keys.forEach(function(key){ | |
| temp.push([key,json[key]]); | |
| }); | |
| return temp; | |
| } | |
| //判断是否有子节点 | |
| function hasleaf(dataArray,id){ | |
| var arr = []; | |
| for(var i= 0,a;a=dataArray[i++];){ | |
| if(id == a[0]){ | |
| return true; | |
| break; | |
| } | |
| // console.log(a[0]); | |
| } | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment