IsAccessorDescriptor.js 465 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. var has = require('has');
  3. var assertRecord = require('../helpers/assertRecord');
  4. var Type = require('./Type');
  5. // https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor
  6. module.exports = function IsAccessorDescriptor(Desc) {
  7. if (typeof Desc === 'undefined') {
  8. return false;
  9. }
  10. assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
  11. if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) {
  12. return false;
  13. }
  14. return true;
  15. };