Skip to content

Instantly share code, notes, and snippets.

@akhoury
Last active December 21, 2015 14:48
Show Gist options
  • Save akhoury/6321852 to your computer and use it in GitHub Desktop.
Save akhoury/6321852 to your computer and use it in GitHub Desktop.
augment a function
var augment = function (base, extra, context) {
return (function () {
return function () {
base.apply(context || this, arguments);
extra.apply(context || this, arguments);
};
})();
};
// usage
console.log = augment(console.log, function(){
console.warn("console.log was called");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment