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

Fixes: Transforming a comma only array to an empty array fails #13

Closed
wants to merge 9 commits into from

Conversation

gandazgul
Copy link

Ok, I realized my mistake on the previous PR (#12), this new code will match modern browser behavior in IE8 by replacing empty array elements with explicit undefined. Using void 0 instead of undefined to guarantee the value doesn't change (Undefined can be reassigned). Handles the case of multiple trailing commas correctly (replace all with undefined except for the last one which is discarded.)

thanks

@gandazgul gandazgul closed this Aug 2, 2016
@sophiebits
Copy link
Owner

[,,] is still slightly different from [undefined, undefined] -- in the former, the keys are not set at all (and '0' in arr would be false) and in the latter, they are set to undefined. I'm not going to merge a transformation to undefined but if it's working for you, please continue using it!

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