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.
14 lines
490 B
14 lines
490 B
var isObj = require('./isObj');
|
|
var isFn = require('./isFn');
|
|
var getPrototypeOf = Object.getPrototypeOf;
|
|
var ObjectCtr = {}.constructor;
|
|
exports = function(obj) {
|
|
if (!isObj(obj)) return;
|
|
if (getPrototypeOf && !false) return getPrototypeOf(obj);
|
|
var proto = obj.__proto__;
|
|
if (proto || proto === null) return proto;
|
|
if (isFn(obj.constructor)) return obj.constructor.prototype;
|
|
if (obj instanceof ObjectCtr) return ObjectCtr.prototype;
|
|
};
|
|
|
|
module.exports = exports;
|
|
|