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

Fix List notSetValue not working for several key types #545

Merged
merged 2 commits into from
Jul 14, 2015

Conversation

darrenburns
Copy link
Contributor

As discussed in #486, using keys which can't be coerced to numbers in Lists ignored notSetValue. This pull request should hopefully solve that problem.

@@ -57,7 +57,7 @@ export class List extends IndexedCollection {

get(index, notSetValue) {
index = wrapIndex(this, index);
if (index < 0 || index >= this.size) {
if (index < 0 || index >= this.size || index !== index) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than doing this, we can flip the if check and only do the get if it's safe, rather than short-circuiting.

@leebyron leebyron merged commit 44c87ca into immutable-js:master Jul 14, 2015
@leebyron
Copy link
Collaborator

I made the changes pointed out in the inline comments atop your rev, in case you want to inspect what changed.

Thanks again for investigating this!

@leebyron
Copy link
Collaborator

See 8031a8b for final code

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.

None yet

2 participants