You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
1.1 KiB
22 lines
1.1 KiB
var DESCRIPTORS = require('../internals/descriptors'); |
|
var call = require('../internals/function-call'); |
|
var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable'); |
|
var createPropertyDescriptor = require('../internals/create-property-descriptor'); |
|
var toIndexedObject = require('../internals/to-indexed-object'); |
|
var toPropertyKey = require('../internals/to-property-key'); |
|
var hasOwn = require('../internals/has-own-property'); |
|
var IE8_DOM_DEFINE = require('../internals/ie8-dom-define'); |
|
|
|
// eslint-disable-next-line es-x/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 = toPropertyKey(P); |
|
if (IE8_DOM_DEFINE) try { |
|
return $getOwnPropertyDescriptor(O, P); |
|
} catch (error) { /* empty */ } |
|
if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]); |
|
};
|
|
|