some cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-09-30 16:34:25 +04:00
parent 1393c03f5b
commit c3d57ce9a8

View File

@ -375,13 +375,14 @@
// equivalent to instanceof: // equivalent to instanceof:
function isInstanceOf(obj, proto){ function isInstanceOf(obj, proto){
return proto instanceof Function return obj === Function && proto === Function ? true
: (isInstanceOf(proto, Function)
&& (obj.__proto__ === proto.prototype ? true && (obj.__proto__ === proto.prototype ? true
// NOTE: the last in this chain is Object.prototype.__proto__ // NOTE: the last in this chain is Object.prototype.__proto__
// and it is null // and it is null
: obj.__proto__ == null ? false : obj.__proto__ == null ? false
// go down the chain... // go down the chain...
: isInstanceOf(obj.__proto__, proto)) : isInstanceOf(obj.__proto__, proto)))
} }
isInstanceOf(c, C) // -> true isInstanceOf(c, C) // -> true