diff options
Diffstat (limited to 'src/node_modules/es-abstract/5/IsDataDescriptor.js')
-rw-r--r-- | src/node_modules/es-abstract/5/IsDataDescriptor.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/node_modules/es-abstract/5/IsDataDescriptor.js b/src/node_modules/es-abstract/5/IsDataDescriptor.js new file mode 100644 index 0000000..783e2dc --- /dev/null +++ b/src/node_modules/es-abstract/5/IsDataDescriptor.js @@ -0,0 +1,23 @@ +'use strict'; + +var has = require('has'); + +var Type = require('./Type'); + +var assertRecord = require('../helpers/assertRecord'); + +// https://ecma-international.org/ecma-262/5.1/#sec-8.10.2 + +module.exports = function IsDataDescriptor(Desc) { + if (typeof Desc === 'undefined') { + return false; + } + + assertRecord(Type, 'Property Descriptor', 'Desc', Desc); + + if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { + return false; + } + + return true; +}; |