Promise.null, its typeof matches either object or function and if it has a .then property, which is also a function.const isPromiseLike = obj =>
obj !== null &&
(typeof obj === 'object' || typeof obj === 'function') &&
typeof obj.then === 'function';
isPromiseLike({
then: function() {
return '';
}
}); // true
isPromiseLike(null); // false
isPromiseLike({}); // falseSubscribe to get resources directly to your inbox. You won't receive any spam! ✌️