Skip to content

Instantly share code, notes, and snippets.

@tfluehr
Created January 19, 2010 18:10
Show Gist options
  • Save tfluehr/281135 to your computer and use it in GitHub Desktop.
Save tfluehr/281135 to your computer and use it in GitHub Desktop.
function getObject(parts)
{
if (typeof(parts) == 'string')
parts = parts.split('.');
var obj = window;
for (var i = 0, p; obj && (p = parts[i]); i++)
{
obj = (p in obj ? obj[p] : undefined);
}
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment