Skip to content

Conversation

@bmeurer
Copy link
Contributor

@bmeurer bmeurer commented Apr 20, 2017

The sequence

component && typeof component === 'object'

checks whether component is any JavaScript object except document.all.
Since document.all cannot occur here, this can be replaced with the
usual

typeof component === 'object' && component !== null

sequence, which yields true for all JavaScript objects and is well
optimized by all JavaScript engines.

The sequence
```
component && typeof component === 'object'
```
checks whether component is any JavaScript object except document.all.
Since document.all cannot occur here, this can be replaced with the
usual
```
typeof component === 'object' && component !== null
```
sequence, which yields true for all JavaScript objects and is well
optimized by all JavaScript engines.
@gaearon
Copy link
Collaborator

gaearon commented Apr 20, 2017

Looks good to me, thanks. Let’s wait for CI.

@bmeurer
Copy link
Contributor Author

bmeurer commented Apr 20, 2017

That being said: it obviously filters out callable objects still.

@bvaughn
Copy link
Contributor

bvaughn commented Apr 20, 2017

Looks like you need to run yarn prettier to format the code. Since the line's longer now, Prettier wants to split it:

if (
  typeof component === "object" &&
  component !== null &&
  component.key != null
) {

@bmeurer
Copy link
Contributor Author

bmeurer commented Apr 20, 2017

Done. Although it didn't split it into three lines.

@gaearon
Copy link
Collaborator

gaearon commented Apr 20, 2017

Likely because we haven’t updated to the last version yet (we will soon).

@bmeurer
Copy link
Contributor Author

bmeurer commented Apr 25, 2017

Anything else missing?

@bvaughn
Copy link
Contributor

bvaughn commented Apr 25, 2017

Oh, my bad. My local prettier did but I may have been using a diff version. :)

No, looks good. Thanks for following up!

@bvaughn bvaughn merged commit 0e587c1 into facebook:master Apr 25, 2017
@bmeurer
Copy link
Contributor Author

bmeurer commented Apr 25, 2017

Thanks!

@sophiebits
Copy link
Collaborator

Thanks @bmeurer!

koba04 added a commit to koba04/react that referenced this pull request Apr 26, 2017
koba04 added a commit to koba04/react that referenced this pull request May 8, 2017
koba04 added a commit to koba04/react that referenced this pull request Jun 12, 2017
koba04 added a commit to koba04/react that referenced this pull request Jun 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants