Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix invalid array termination for null and undefined #38

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

Merged
kateinoigakukun merged 2 commits into master from fix/array-iterator
Aug 27, 2020

Conversation

@kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented Aug 27, 2020

No description provided.

Copy link
Member

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

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

Seems legit 👍

@kateinoigakukun kateinoigakukun deleted the fix/array-iterator branch August 27, 2020 12:26
Copy link
Member

j-f1 commented Aug 27, 2020

Not entirely sure how this should be handled, but JS Arrays support "holes", where [1,,3] creates an array without anything at index 1. From the outside, that index appears to contain undefined, but array methods like map and forEach skip over those indices while iterating, and flat removes them, changing the indices of everything that comes after the hole. You can tell the difference between a hole and an undefined value with either index in array or array.hasOwnProperty(index).

I think it’s perfectly fine to simply say that holes are not handled properly since they’re quite rare in practice but I wanted to make sure this language quirk wasn’t missed.

Copy link
Member

Do present test cases handle this quirk adequately or is there anything else you'd like to be covered in the test suite?

Copy link
Member

j-f1 commented Aug 27, 2020

I don’t believe there are any tests that involve array holes in the current test suite so if we want to support it new tests would need to be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@MaxDesiatov MaxDesiatov MaxDesiatov approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /