Skip to content

Instantly share code, notes, and snippets.

@jonasporto
Created March 14, 2018 22:03
Show Gist options
  • Save jonasporto/a3015afc7aa7db39fd35c6aa28036d64 to your computer and use it in GitHub Desktop.
Save jonasporto/a3015afc7aa7db39fd35c6aa28036d64 to your computer and use it in GitHub Desktop.
const handler = {
get: function(obj, prop) {
if (typeof obj[prop] == 'function') {
return (...args) => {
return obj[prop].apply(this, args)
}
}
return obj[prop];
}
};
const s = new Proxy(obj, handler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment