promise-capability-record.js 446 B

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