Created
May 20, 2014 00:17
-
-
Save xenophy/d081d4282a04f229e4ce to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function(path) { | |
var paths = path.split('.'), | |
current = window, | |
i, len; | |
len = paths.length; | |
for (i = 0; i < len; ++i) { | |
if (current[paths[i]] == undefined) { | |
return undefined; | |
} else { | |
current = current[paths[i]]; | |
} | |
} | |
return current; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment