1 | 'use strict';
|
2 | var hasOwn = require('../internals/has-own-property');
|
3 | var isCallable = require('../internals/is-callable');
|
4 | var toObject = require('../internals/to-object');
|
5 | var sharedKey = require('../internals/shared-key');
|
6 | var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');
|
7 |
|
8 | var IE_PROTO = sharedKey('IE_PROTO');
|
9 | var $Object = Object;
|
10 | var ObjectPrototype = $Object.prototype;
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
|
16 | var object = toObject(O);
|
17 | if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
|
18 | var constructor = object.constructor;
|
19 | if (isCallable(constructor) && object instanceof constructor) {
|
20 | return constructor.prototype;
|
21 | } return object instanceof $Object ? ObjectPrototype : null;
|
22 | };
|