_object-gopd.js 577 B

1234567891011121314151617
  1. var pIE = require('./_object-pie');
  2. var createDesc = require('./_property-desc');
  3. var toIObject = require('./_to-iobject');
  4. var toPrimitive = require('./_to-primitive');
  5. var has = require('./_has');
  6. var IE8_DOM_DEFINE = require('./_ie8-dom-define');
  7. var gOPD = Object.getOwnPropertyDescriptor;
  8. exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {
  9. O = toIObject(O);
  10. P = toPrimitive(P, true);
  11. if (IE8_DOM_DEFINE) try {
  12. return gOPD(O, P);
  13. } catch (e) { /* empty */ }
  14. if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
  15. };