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

_.sortBy option for sorting null values to end #2244

Closed
jvincilione opened this issue Jul 23, 2015 · 1 comment
Closed

_.sortBy option for sorting null values to end #2244

jvincilione opened this issue Jul 23, 2015 · 1 comment

Comments

@jvincilione
Copy link

Currently, _.sortBy doesn't sort null values. I believe an optional param to decide what to do with null and possibly undefined (which currently defaults to end) would be a good feature.

It's a pretty simple addition, and I have already coded the feature into a project I'm working on, and can a do a PR if you believe this is a feature worth adding.

@megawac
Copy link
Collaborator

megawac commented Jul 23, 2015

Hey, there are a number of issues currently open related to sort order for spurius values (namely NaN and undefined) #1768 #2041 #2042 and others.

We're probably going to leave null as is to avoid a breaking change; but it should be easy enough to handle in the comparator function

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

No branches or pull requests

2 participants