isPromise.js 362 B

1234567891011121314151617
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true,
  4. });
  5. exports.isPromise = isPromise;
  6. /**
  7. * Returns true if the value acts like a Promise, i.e. has a "then" function,
  8. * otherwise returns false.
  9. */
  10. function isPromise(value) {
  11. return (
  12. typeof (value === null || value === void 0 ? void 0 : value.then) ===
  13. 'function'
  14. );
  15. }