electron/lib/common/is-promise.ts

13 lines
301 B
TypeScript
Raw Normal View History

export function isPromise (val: any) {
2016-05-25 05:38:35 +00:00
return (
val &&
val.then &&
val.then instanceof Function &&
val.constructor &&
val.constructor.reject &&
val.constructor.reject instanceof Function &&
val.constructor.resolve &&
val.constructor.resolve instanceof Function
)
}