Created
September 2, 2014 13:57
-
-
Save falkolab/ce8c8678b5ba1ed68427 to your computer and use it in GitHub Desktop.
Find views in view hierarchy that corresponded specified properties. Titanium Alloy.
This file contains 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
var findViews = function(where, props, deep) { | |
var ctl = _.where(where.children, props); | |
if(deep){ | |
return _.reduce(where.children, function(memo, view) { | |
return memo.concat(findViews(view, props, true)); | |
}, ctl); | |
} else { | |
return ctl; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
do you have a small usage example for this function?