Skip to content

Instantly share code, notes, and snippets.

@netpoetica
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netpoetica/6cb636b139e072984774 to your computer and use it in GitHub Desktop.
Save netpoetica/6cb636b139e072984774 to your computer and use it in GitHub Desktop.
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