Skip to content

Instantly share code, notes, and snippets.

@xenophy
Created May 20, 2014 00:17
Show Gist options
  • Save xenophy/d081d4282a04f229e4ce to your computer and use it in GitHub Desktop.
Save xenophy/d081d4282a04f229e4ce to your computer and use it in GitHub Desktop.
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