IsDataDescriptor.js 449 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.2
  6. module.exports = function IsDataDescriptor(Desc) {
  7. if (typeof Desc === 'undefined') {
  8. return false;
  9. }
  10. assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
  11. if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) {
  12. return false;
  13. }
  14. return true;
  15. };