If I have a function that sometimes returns a deferred object but sometimes a non-deferred object. How can I tell which one it is?
Inspired by Niko's answer, I created another implementation that would check if an object is a deferred based on the name of it's properties but also on the content of those properties. I had to do so since an other object of mine had a property named promise.
if (typeof value.resolve !== "function") {
return false;
}
return String(value.resolve) === String($.Deferred().resolve);