Skip to content

Instantly share code, notes, and snippets.

@aalin
Created May 20, 2015 06:28
Show Gist options
  • Save aalin/261e93712e6e39f5a3ef to your computer and use it in GitHub Desktop.
Save aalin/261e93712e6e39f5a3ef to your computer and use it in GitHub Desktop.
var debugArgsPatch = (object, property) => {
if (typeof object[property] !== 'function') {
throw `Object does not have the function ${property}`;
}
var origFunc = object[property];
object[property] = (...args) => {
console.log(`Call ${property}:`, args);
var ret = origFunc.apply(object, args);
console.log(`Ret ${property}:`, ret);
return ret;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment