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 errors on symbols. #2501

Closed
jdalton opened this issue Apr 15, 2016 · 1 comment
Closed

_.sortBy errors on symbols. #2501

jdalton opened this issue Apr 15, 2016 · 1 comment

Comments

@jdalton
Copy link
Contributor

jdalton commented Apr 15, 2016

_.sortBy([1, Symbol()]);
// errors

This affects _.max and _.min too.

xcodebuild added a commit to xcodebuild/underscore that referenced this issue Apr 25, 2016
xcodebuild added a commit to xcodebuild/underscore that referenced this issue Apr 25, 2016
xcodebuild added a commit to xcodebuild/underscore that referenced this issue Apr 28, 2016
@jgonggrijp
Copy link
Collaborator

_.sortBy is for when you can reduce your values to a single string or number so that you can meaningfully apply the < operator. If you need to do something more fancy, pass your own custom comparator function to Array.prototype.sort instead. Note that this function is also available in Underscore OOP notation and in chains as _(yourArray).sort.

Related to #2848.

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 a pull request may close this issue.

2 participants