Created
June 19, 2014 11:41
-
-
Save epappas/06ea45d87e0af47d060b to your computer and use it in GitHub Desktop.
Traverse complex objects
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 obj(o) { | |
var args = Array.prototype.slice.call(arguments, 1); | |
return (function __get(o, args) { | |
var key = args.shift(); | |
if(key !== undefined) return __get(o[key] || { }, args); | |
return o; | |
})(o, args); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment