isPromise.js 356 B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = isPromise;
  6. /**
  7. * Returns true if the value acts like a Promise, i.e. has a "then" function,
  8. * otherwise returns false.
  9. */
  10. // eslint-disable-next-line no-redeclare
  11. function isPromise(value) {
  12. return Boolean(value && typeof value.then === 'function');
  13. }