promise-capability-record.js 495 B

12345678910111213141516
  1. 'use strict';
  2. var hasOwn = require('hasown');
  3. module.exports = function isPromiseCapabilityRecord(value) {
  4. return !!value
  5. && typeof value === 'object'
  6. && hasOwn(value, '[[Resolve]]')
  7. && typeof value['[[Resolve]]'] === 'function'
  8. && hasOwn(value, '[[Reject]]')
  9. && typeof value['[[Reject]]'] === 'function'
  10. && hasOwn(value, '[[Promise]]')
  11. && !!value['[[Promise]]']
  12. && typeof value['[[Promise]]'] === 'object'
  13. && typeof value['[[Promise]]'].then === 'function';
  14. };