Skip to content

Conversation

@gibson042
Copy link
Member

No description provided.

@mgol
Copy link
Member

mgol commented Nov 9, 2015

Nice!

Copy link
Member

Choose a reason for hiding this comment

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

Why not a strict comparison to undefined here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I reserve those for cases where we explicitly want to differentiate null and undefined in order to keep the minified output more compressible. Each === undefined costs about a byte.

Copy link
Member

Choose a reason for hiding this comment

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

I'm okay with that as long as we document it somewhere. The first thing I did when I saw this was look for a place where it might be assigned null thinking the check for both was important. The style guide example implies we do it to check for both.

Copy link
Member Author

Choose a reason for hiding this comment

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

Any thoughts on how to document it? I see what you mean about the style guide, and even though this technically fits because I'd allow null to pass, the fact is that it will never come up so it's arguably against the spirit of our style guide. I could also just suck it up and use === undefined if you think the current approach is confusing.

Copy link
Member

Choose a reason for hiding this comment

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

What does everyone else think? To me the === undefined is clearer and worth a byte.

Copy link
Member

Choose a reason for hiding this comment

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

I'm ambivalent. I'd be fine with whichever.

@gibson042 gibson042 closed this in eaa3e9f Nov 19, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants