Closed
Description
The documentation for util.isObject
states:
Returns true if the given "object" is strictly an Object. false otherwise.
What exactly does "strictly an Object" mean? That the type of the argument is Object? Nope:
> var f = function(){}
undefined
> util.isObject(f)
false
Or maybe it does an instanceof
check? That also isn't the case:
> var o = Object.create(null)
undefined
> o instanceof Object
false
> util.isObject(o)
true
Does it check that the [[Class]] internal property is "Object"? Also no:
> Object.prototype.toString.call(JSON)
'[object JSON]'
> util.isObject(JSON)
true
Either the docs should be updated to clarify the behavior, or the implementation should be fixed. I would vote for the latter, otherwise the function name is confusing.