]> git.r.bdr.sh - rbdr/dotfiles/blob
9a2823198e746ff49a7bc8257565c711e416486d
[rbdr/dotfiles] /
1 'use strict';
2
3 var getPrototypeOf = Object.getPrototypeOf, prototype = Object.prototype
4 , toString = prototype.toString
5
6 , id = Object().toString();
7
8 module.exports = function (value) {
9 var proto, constructor;
10 if (!value || (typeof value !== 'object') || (toString.call(value) !== id)) {
11 return false;
12 }
13 proto = getPrototypeOf(value);
14 if (proto === null) {
15 constructor = value.constructor;
16 if (typeof constructor !== 'function') return true;
17 return (constructor.prototype !== value);
18 }
19 return (proto === prototype) || (getPrototypeOf(proto) === null);
20 };