Comparing version 0.0.2 to 0.0.3
@@ -32,3 +32,3 @@ /* ZenWANG@zenw.org 12/Mar/2020 */ | ||
if (!_isFunction(originalFunction)) throw new Error('Cannot monkeyify a non-function variable! ⊂((≧⊥≦))⊃~'); | ||
if ('function' === typeof patchOpt) patchOpt = { monkey: patchOpt }; | ||
if (_isFunction(patchOpt)) patchOpt = { monkey: patchOpt }; | ||
var hasCaller = Object.prototype.hasOwnProperty.call(patchOpt, 'caller'); | ||
@@ -35,0 +35,0 @@ var _patchFunc = patchOpt.monkey; |
{ | ||
"name": "monkeyify", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Monkey patch factory", | ||
@@ -14,2 +14,3 @@ "main": "monkeyify.js", | ||
"keywords": [ | ||
"monkey-patch", | ||
"monkey", | ||
@@ -16,0 +17,0 @@ "patch", |
@@ -8,4 +8,11 @@ # monkeyify | ||
window.atob = monkeyify(window.atob, { | ||
caller: {name: 'I am the caller, I will be given in the first argument in monkey function'}, | ||
allowMonkeyInMonkey: 'return old monkey'; // true or 'return old monkey' | ||
// bind a caller, the default is the caller when the monkeyify function is called | ||
caller: window, | ||
// true(To monkeyify a monkeyifyed function is allowed) | ||
// 'return old monkey'(Return the first monkeyifyed function when you want to monkeyify a monkeyifyed function) | ||
allowMonkeyInMonkey: 'return old monkey'; | ||
// monkey patch function. caller, args array and the original function | ||
monkey: function (caller, args, original) { | ||
@@ -12,0 +19,0 @@ var base64url = args[0]; |
4979
34