Last active
May 31, 2019 08:08
-
-
Save lovetingyuan/84f70b20a32f500f05f0e0b59af628c8 to your computer and use it in GitHub Desktop.
is it a promise? it is not a duck.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isPromise(v) { | |
return v && typeof v.then === 'function' && Promise.resolve(v) === v && v instanceof Promise | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment