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

Appearance settings

Fix invalid array termination for null and undefined#38

Merged
kateinoigakukun merged 2 commits into
masterswiftwasm/JavaScriptKit:masterfrom
fix/array-iteratorswiftwasm/JavaScriptKit:fix/array-iteratorCopy head branch name to clipboard
Aug 27, 2020
Merged

Fix invalid array termination for null and undefined#38
kateinoigakukun merged 2 commits into
masterswiftwasm/JavaScriptKit:masterfrom
fix/array-iteratorswiftwasm/JavaScriptKit:fix/array-iteratorCopy head branch name to clipboard

Conversation

@kateinoigakukun

Copy link
Copy Markdown
Member

No description provided.

@MaxDesiatov MaxDesiatov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems legit 👍

@kateinoigakukun kateinoigakukun merged commit a1ec259 into master Aug 27, 2020
@kateinoigakukun kateinoigakukun deleted the fix/array-iterator branch August 27, 2020 12:26
@j-f1

j-f1 commented Aug 27, 2020

Copy link
Copy Markdown
Member

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.

@MaxDesiatov

Copy link
Copy Markdown
Member

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

@j-f1

j-f1 commented Aug 27, 2020

Copy link
Copy Markdown
Member

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.