-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.
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)
falseOr 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)
trueDoes it check that the [[Class]] internal property is "Object"? Also no:
> Object.prototype.toString.call(JSON)
'[object JSON]'
> util.isObject(JSON)
trueEither 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.
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.