is-promise.js 320 B

123456789101112131415
  1. 'use strict'
  2. module.exports = function isPromise (val) {
  3. return (
  4. val &&
  5. val.then &&
  6. val.then instanceof Function &&
  7. val.constructor &&
  8. val.constructor.reject &&
  9. val.constructor.reject instanceof Function &&
  10. val.constructor.resolve &&
  11. val.constructor.resolve instanceof Function
  12. )
  13. }