2021-02-26 03:58:33 +00:00
|
|
|
'use strict';
|
|
|
|
|
2024-03-28 02:00:41 +00:00
|
|
|
var $TypeError = require('es-errors/type');
|
2021-02-26 03:58:33 +00:00
|
|
|
|
|
|
|
var IsAccessorDescriptor = require('./IsAccessorDescriptor');
|
|
|
|
var IsDataDescriptor = require('./IsDataDescriptor');
|
|
|
|
|
2024-03-28 02:00:41 +00:00
|
|
|
var isPropertyDescriptor = require('../helpers/records/property-descriptor');
|
|
|
|
|
|
|
|
// https://262.ecma-international.org/6.0/#sec-isgenericdescriptor
|
2021-02-26 03:58:33 +00:00
|
|
|
|
|
|
|
module.exports = function IsGenericDescriptor(Desc) {
|
|
|
|
if (typeof Desc === 'undefined') {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-03-28 02:00:41 +00:00
|
|
|
if (!isPropertyDescriptor(Desc)) {
|
|
|
|
throw new $TypeError('Assertion failed: `Desc` must be a Property Descriptor');
|
|
|
|
}
|
2021-02-26 03:58:33 +00:00
|
|
|
|
|
|
|
if (!IsAccessorDescriptor(Desc) && !IsDataDescriptor(Desc)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|