Last active
August 29, 2015 14:10
-
-
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
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
// 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