IsGenericDescriptor.js 542 B

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