Skip to content

Instantly share code, notes, and snippets.

@gregpalaci
Created October 16, 2023 17:37
Show Gist options
  • Save gregpalaci/f37d7f4fd34327d5be70ea7e57c7c1b2 to your computer and use it in GitHub Desktop.
Save gregpalaci/f37d7f4fd34327d5be70ea7e57c7c1b2 to your computer and use it in GitHub Desktop.
isPromise.js
/**
* 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