isPromise.mjs 261 B

12345678
  1. /**
  2. * Returns true if the value acts like a Promise, i.e. has a "then" function,
  3. * otherwise returns false.
  4. */
  5. // eslint-disable-next-line no-redeclare
  6. export default function isPromise(value) {
  7. return Boolean(value && typeof value.then === 'function');
  8. }