IsAccessorDescriptor.js 446 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. var has = require('has');
  3. var Type = require('./Type');
  4. var assertRecord = require('../helpers/assertRecord');
  5. // https://262.ecma-international.org/5.1/#sec-8.10.1
  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. };