Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Object.is when testing for equality where the === operator was previously used #120

Merged
merged 1 commit into from
Mar 2, 2015

Conversation

papandreou
Copy link
Member

This affects the 'to be' and 'to equal' assertions and means that NaN is considered equal to itself, whereas -0 and 0 are considered different.

Consider this a spike at this point. I realize that the additional text required in the docs to explain the departure from === is a drawback in itself.

Closes #116.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.27%) to 93.71% when pulling 672efe9 on objectIs into ef9fea7 on v6.

@sunesimonsen
Copy link
Member

It looks good. I wunder what the performance impact will be. I also think we should use the native Object.is if it is available. I don't think it is a problem that we have to mention that we use Object.is sematic in the doc.

@papandreou
Copy link
Member Author

I wunder what the performance impact will be

From running the test suite multiple times before and after the change I couldn't measure any difference.

I also think we should use the native Object.is if it is available

That is how I implemented it, see https://github.com/sunesimonsen/unexpected/blob/objectIs/lib/utils.js#L11

The drop in coverage is due to the polyfill only getting exercised by make test-phantomjs btw.

@sunesimonsen
Copy link
Member

Sorry I overlooked that fact that you have it chose the native version if it was available.
It is nice that the performance is the same. I think this is a good change.

@gustavnikolaj
Copy link
Member

LGTM 👍

…eviously used.

This affects the 'to be' and 'to equal' assertions and means that NaN is considered equal to itself, whereas -0 and 0 are considered different.

Closes #116.
papandreou added a commit that referenced this pull request Mar 2, 2015
Use Object.is when testing for equality where the === operator was previously used
@papandreou papandreou merged commit 7d4c076 into v6 Mar 2, 2015
@papandreou papandreou deleted the objectIs branch March 28, 2015 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants