Created
March 12, 2013 19:03
-
-
Save vanceingalls/5145902 to your computer and use it in GitHub Desktop.
works in private scope w/ es5
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
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