https://debugpointer.com/check-if-an-object-is-a-promise/
function isPromise(p) {
return p && Object.prototype.toString.call(p) === "[object Promise]";
}
function isPromise(value) {
return Boolean(value && typeof value.then === "function");
}
function isPromise(object) {
if (Promise && Promise.resolve) {
return Promise.resolve(object) == object;
} else {
throw "Promise not supported in your environment"; // Most modern browsers support Promises
}
}
function isPromise(obj) {
return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
}