Is there a way to determine if a JavaScript function is a bound function?
Example:
I'm new here and don't have enough reputation to post comments, just answers. Sorry, but this does not answer the OP, because I have no clue how to do so. I wish I did.
However, the very common answers relying on a missing prototype property won't work. Class methods, method definitions in objects, and async functions also don't have prototype properties, but they are not naturally bound.
Also, bear in mind that it's still possible to manually bind a function by closure, which would defy any attempts to detect its bound state:
const bind=(fn,obj)=>{
return (...args)=>{
return fn.apply(obj,args)
}
}