Skip to content

Instantly share code, notes, and snippets.

@jaggy
Created August 28, 2017 14:07
Show Gist options
  • Save jaggy/17c7e114d434c098c16e8d250f1d3dc2 to your computer and use it in GitHub Desktop.
Save jaggy/17c7e114d434c098c16e8d250f1d3dc2 to your computer and use it in GitHub Desktop.
Higher order tap for javascript
function tap (object) {
return new Proxy(object, {
get: function (target, attribute) {
return function (...args) {
target[attribute].apply(target, args);
return target;
};
},
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment