Created
October 16, 2023 17:37
-
-
Save jswhisperer/f37d7f4fd34327d5be70ea7e57c7c1b2 to your computer and use it in GitHub Desktop.
isPromise.js
This file contains 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
/** | |
* Determine whether the given `promise` is a Promise. | |
* | |
* @param {*} promise | |
* | |
* @returns {Boolean} | |
*/ | |
function isPromise(promise) { | |
return !!promise && typeof promise.then === 'function' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment