Created
February 7, 2016 21:35
-
-
Save gmmorris/c9e085e9b49e9d08bd2a to your computer and use it in GitHub Desktop.
Implementation for the Safe Access Proxy article
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 safe(obj) { | |
return new Proxy(obj, { | |
get: function(target, name){ | |
return hasKey(target, name) ? | |
(isObject(target[name]) ? safe(target[name]) : target[name]) : Undefined; | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment