Created
May 20, 2015 06:28
-
-
Save aalin/261e93712e6e39f5a3ef to your computer and use it in GitHub Desktop.
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
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