123456789101112131415161718192021 |
- var DESCRIPTORS = require('../internals/descriptors');
- var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
- var createPropertyDescriptor = require('../internals/create-property-descriptor');
- var toIndexedObject = require('../internals/to-indexed-object');
- var toPrimitive = require('../internals/to-primitive');
- var has = require('../internals/has');
- var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // `Object.getOwnPropertyDescriptor` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
- exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
- O = toIndexedObject(O);
- P = toPrimitive(P, true);
- if (IE8_DOM_DEFINE) try {
- return $getOwnPropertyDescriptor(O, P);
- } catch (error) { /* empty */ }
- if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
- };
|