8000 Improves default sorting comparator when undefined values are present. · Pull Request #922 · immutable-js/immutable-js · GitHub
[go: up one dir, main page]

Skip to content

Improves default sorting comparator when undefined values are present. #922

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
merged 1 commit into from Dec 2, 2016
Merged

Conversation

ghost
Copy link
@ghost ghost commented Jul 14, 2016

Immutable.List([ 4, undefined, 5, 6, 3, undefined, 2, 1 ]).sort().toJS() currently returns:
[4, undefined, 3, 5, 6, undefined, 1, 2]

This change alters the behaviour to work in the same way as native JS, which is:

[4, undefined, 5, 6, 3, undefined, 2, 1].sort()
[1, 2, 3, 4, 5, 6, undefined, undefined]

Fixes #930

@ghost
Copy link
ghost commented Jul 14, 2016

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@ghost ghost added the CLA Signed label Jul 14, 2016
@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@stephanschubert
Copy link

Also lodash/sortBy has the same behaviour and sorts undefined to the end.

@lacker lacker merged commit 24c834a into immutable-js:master Dec 2, 2016
@lacker
Copy link
lacker commented Dec 2, 2016

This seems like a good thing to do. Thank you!

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

Successfully merging this pull request may close these issues.

3 participants
0