Skip to content

Return value of getIn(undefined) #256

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

Closed
baskerville opened this issue Dec 20, 2014 · 5 comments
Closed

Return value of getIn(undefined) #256

baskerville opened this issue Dec 20, 2014 · 5 comments

Comments

@baskerville
Copy link

If m is a map, m.getIn(undefined) returns m.

I was expecting undefined as return value.

@leebyron
Copy link
Collaborator

Can I ask why you were expecting undefined as the return value?

I think right now, when providing undefined as a key-path, it's interpreted as the empty key path. I don't have a strong opinion about this being The Right Way, so I'm open to a discussion about it.

Another approach may be to consider undefined an illegal input and throw an exception instead. What do you think of that?

@dashed
Copy link
Contributor

dashed commented Dec 20, 2014

I think undefined should be considered an illegal input since it's neither an Array nor an Iterable.

@baskerville
Copy link
Author

@leebyron I conceived a bad analogy between get(undefined) and getIn(undefined): indeed undefined isn't a valid input for getIn.

@leebyron
Copy link
Collaborator

Ok, I hear the consensus for this being illegal input and I agree.

@baskerville
Copy link
Author

It seems that hasIn is still affected.

leebyron added a commit that referenced this issue Jan 6, 2015
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

No branches or pull requests

3 participants