How can I compare functions which were bounded before independently on context (this).
I know that Function.prototype.bind returns new function but is it possible to find out reference to the original function?
Let's say I want to implement function equalsOrigins
to do it for me:
var func1 = someFunction.bind(obj1);
var func2 = someFunction.bind(obj2);
var func3 = otherFunction.bind(obj1);
func1 === func2; // naturally returns false
equalsOrigins(func1, func2); // should return true
equalsOrigins(func1, func3); // should return false
equalsOrigins(func2, func3); // should return false
Is that possible in javascript?