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.
18 lines
713 B
18 lines
713 B
|
3 years ago
|
var has = require('../internals/has');
|
||
|
|
var toObject = require('../internals/to-object');
|
||
|
|
var sharedKey = require('../internals/shared-key');
|
||
|
|
var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');
|
||
|
|
|
||
|
|
var IE_PROTO = sharedKey('IE_PROTO');
|
||
|
|
var ObjectPrototype = Object.prototype;
|
||
|
|
|
||
|
|
// `Object.getPrototypeOf` method
|
||
|
|
// https://tc39.github.io/ecma262/#sec-object.getprototypeof
|
||
|
|
module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
|
||
|
|
O = toObject(O);
|
||
|
|
if (has(O, IE_PROTO)) return O[IE_PROTO];
|
||
|
|
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
|
||
|
|
return O.constructor.prototype;
|
||
|
|
} return O instanceof Object ? ObjectPrototype : null;
|
||
|
|
};
|