Skip to content

Instantly share code, notes, and snippets.

@netpoetica netpoetica/propDeepExists
Last active Aug 29, 2015

Embed
What would you like to do?
Check if a property exists - for use in debugger only. Very slow operation
// Note: this function is evil, and probably should never be used.
// It may be useful for when you are working in the console/debugger
// and need to analyze some large object. Not for production.
// http://jsperf.com/check-if-deep-property-exists-with-willnotthrow
function propDeepExists(target, propPath){
try {
var result = eval("target." + propPath);
} catch(e){
return false;
}
return result ? true : false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.