Determine type of an object.
Like obj.constructor, but won't fail
for null/undefined and just returns the
value itself for those.
This is a useful feature for code that is supposed to be
null/undefined-safe since those need not be special cased.