Skip to content

Instantly share code, notes, and snippets.

@vanceingalls
Created March 12, 2013 19:06
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 vanceingalls/5145935 to your computer and use it in GitHub Desktop.
Save vanceingalls/5145935 to your computer and use it in GitHub Desktop.
// works in private scope w/ es5
function resolve (str) {
return str.split('.').reduce(function (prev, curr, ind) {
return ind < 2 ? eval(prev)[curr] : prev[curr];
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment