node_modules/es-abstract/2015/CompletePropertyDescriptor.js in immosquare-cleaner-0.1.32 vs node_modules/es-abstract/2015/CompletePropertyDescriptor.js in immosquare-cleaner-0.1.38
- old
+ new
@@ -1,39 +1,43 @@
'use strict';
-var has = require('has');
+var $TypeError = require('es-errors/type');
-var assertRecord = require('../helpers/assertRecord');
+var hasOwn = require('hasown');
var IsDataDescriptor = require('./IsDataDescriptor');
var IsGenericDescriptor = require('./IsGenericDescriptor');
-var Type = require('./Type');
+var isPropertyDescriptor = require('../helpers/records/property-descriptor');
+
// https://262.ecma-international.org/6.0/#sec-completepropertydescriptor
module.exports = function CompletePropertyDescriptor(Desc) {
+ if (!isPropertyDescriptor(Desc)) {
+ throw new $TypeError('Assertion failed: `Desc` must be a Property Descriptor');
+ }
+
/* eslint no-param-reassign: 0 */
- assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) {
- if (!has(Desc, '[[Value]]')) {
+ if (!hasOwn(Desc, '[[Value]]')) {
Desc['[[Value]]'] = void 0;
}
- if (!has(Desc, '[[Writable]]')) {
+ if (!hasOwn(Desc, '[[Writable]]')) {
Desc['[[Writable]]'] = false;
}
} else {
- if (!has(Desc, '[[Get]]')) {
+ if (!hasOwn(Desc, '[[Get]]')) {
Desc['[[Get]]'] = void 0;
}
- if (!has(Desc, '[[Set]]')) {
+ if (!hasOwn(Desc, '[[Set]]')) {
Desc['[[Set]]'] = void 0;
}
}
- if (!has(Desc, '[[Enumerable]]')) {
+ if (!hasOwn(Desc, '[[Enumerable]]')) {
Desc['[[Enumerable]]'] = false;
}
- if (!has(Desc, '[[Configurable]]')) {
+ if (!hasOwn(Desc, '[[Configurable]]')) {
Desc['[[Configurable]]'] = false;
}
return Desc;
};