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

Handle null values when comparing objects #1568

Merged
merged 1 commit into from
Oct 11, 2017
Merged

Conversation

posva
Copy link
Member

@posva posva commented Jul 5, 2017

Fix #1566

@callumacrae I couldn't see why the error was happening in circleci (infinite loading) and wanted to change some things, so I created a new PR. I hope this doesn't bother you.
To answer your question, the problem was there was a non-caught exception, so I tested that and equality as well. But I should test that as well, let me add a commit for that

@callumacrae
Copy link

What should happen with { foo: null } and { foo: undefined }? Should they be equal?

@posva
Copy link
Member Author

posva commented Jul 5, 2017

IMO no, but I also wrote that code 😆
As a developer, you have to be consistent, I think, so either use null or undefined (I'd choose null)

@javoski
Copy link
Member

javoski commented Jul 6, 2017

Maybe a shared util function isObject will be helpful, it also can be reused in many places in this repo.

function isObject (val) {
  return val !== null && typeof val === 'object'
}

@anxolin
Copy link

anxolin commented Jul 17, 2017

+1

@posva
Copy link
Member Author

posva commented Aug 15, 2017

ping @yyx990803
@javoski I haven't checked, but yeah, maybe we could refactor some code

@webrsb
Copy link

webrsb commented Nov 4, 2018

Resolve #1722

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.

6 participants