_object-gpo.js 497 B

12345678910111213
  1. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  2. var has = require('./_has')
  3. , toObject = require('./_to-object')
  4. , IE_PROTO = require('./_shared-key')('IE_PROTO')
  5. , ObjectProto = Object.prototype;
  6. module.exports = Object.getPrototypeOf || function(O){
  7. O = toObject(O);
  8. if(has(O, IE_PROTO))return O[IE_PROTO];
  9. if(typeof O.constructor == 'function' && O instanceof O.constructor){
  10. return O.constructor.prototype;
  11. } return O instanceof Object ? ObjectProto : null;
  12. };