Function.prototype.unmethodize >= 0.1.0
Purpose
Create a function that will call the given function with the first argument as the context
Syntax
Function#unmethodize
(
Stringname
);
Parameters
name
- The name to use for the wrapper
Return values
Function
Examples
var obj = {whatever: 'TEST'},
unmethod,
fnc = function(){
return this.whatever;
};
// Just executing the function will return nothing
fnc();>>> undefined
// Passing a variable won't do anything either
fnc(obj);>>> undefined
unmethod = fnc.unmethodize();
unmethod(obj);>>> "TEST"
Comments