Created
August 28, 2017 14:07
-
-
Save jaggy/17c7e114d434c098c16e8d250f1d3dc2 to your computer and use it in GitHub Desktop.
Higher order tap for javascript
This file contains hidden or 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 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