UNPKG
is-promise
Version:
latest (4.0.0)
4.0.0
3.0.0
2.2.2
2.2.1
2.2.0
2.1.0
2.0.0
1.0.1
1.0.0
Test whether an object looks like a promises-a+ promise
github.com/then/is-promise
then/is-promise
is-promise
/
index.mjs
4 lines
(3 loc)
•
151 B
JavaScript
View Raw
1
2
3
4
export
default
function
isPromise
(
obj
) {
return
!!obj && (
typeof
obj ===
'object'
||
typeof
obj ===
'function'
) &&
typeof
obj.
then
===
'function'
; }