es.object.get-own-property-descriptor.js 771 B

12345678910111213141516
  1. var $ = require('../internals/export');
  2. var fails = require('../internals/fails');
  3. var toIndexedObject = require('../internals/to-indexed-object');
  4. var nativeGetOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
  5. var DESCRIPTORS = require('../internals/descriptors');
  6. var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
  7. var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
  8. // `Object.getOwnPropertyDescriptor` method
  9. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  10. $({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
  11. getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
  12. return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
  13. }
  14. });