isPromise.js.flow 366 B

12345678910111213
  1. // @flow strict
  2. /**
  3. * Returns true if the value acts like a Promise, i.e. has a "then" function,
  4. * otherwise returns false.
  5. */
  6. declare function isPromise(value: mixed): boolean %checks(value instanceof
  7. Promise);
  8. // eslint-disable-next-line no-redeclare
  9. export default function isPromise(value) {
  10. return Boolean(value && typeof value.then === 'function');
  11. }