1var findObjectByLabel = function(obj, label) {
2 if(obj.label === label) { return obj; }
3 for(var i in obj) {
4 if(obj.hasOwnProperty(i)){
5 var foundLabel = findObjectByLabel(obj[i], label);
6 if(foundLabel) { return foundLabel; }
7 }
8 }
9 return null;
10};