I'm in a situation where I would want to know if a function is already bound in order to set a warning message when that function is invoked with call
or apply
with a different context.
function myfn (){ }
/* or */
var myfn = function () {}
var ref = myfn.bind(null);
I checked the function object in Firefox and Chrome console and the only difference I found is that the bound version has the name prefixed with bound
.
> myfn.name
> "myfn"
> ref.name
> "bound myfn"
Is this a reliable check ?
Are there more ways to find if function is already bound ?
*NOTE: Not interested in older browsers (ex : <ie10
)