IsGenericDescriptor.js 555 B

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