Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Add note that isObject returns true for arrays/functions #6353

Closed
wants to merge 2 commits into from

Conversation

cnlevy
Copy link
Contributor

@cnlevy cnlevy commented Feb 19, 2014

No description provided.

@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#6353)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@@ -445,7 +445,8 @@ function isDefined(value){return typeof value !== 'undefined';}
*
* @description
* Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not
* considered to be objects.
* considered to be objects. Note that JavaScript arrays and functions are objects,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and functions ...

No, JavaScript does not report the type of a function as an object, even though they are object-like. isObject() will return false for functions

@khepin
Copy link

khepin commented Feb 20, 2014

If adding this, it would be worth adding that functions will also be considered objects.

@caitp
Copy link
Contributor

caitp commented Feb 20, 2014

Yeah, functions are not considered objects by angular.isObject(), it's really just a short form for value && typeof(value) === "object". I can appreciate that that might be confusing =)

@caitp caitp closed this in 3193a3a Feb 20, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants