Skip to content

Instantly share code, notes, and snippets.

@gmmorris
Created February 7, 2016 21:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmmorris/c9e085e9b49e9d08bd2a to your computer and use it in GitHub Desktop.
Save gmmorris/c9e085e9b49e9d08bd2a to your computer and use it in GitHub Desktop.
Implementation for the Safe Access Proxy article
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