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

d3.sort, but with an accessor (length = 1) instead of a comparator. #182

Closed
mbostock opened this issue Dec 1, 2020 · 0 comments · Fixed by #183
Closed

d3.sort, but with an accessor (length = 1) instead of a comparator. #182

mbostock opened this issue Dec 1, 2020 · 0 comments · Fixed by #183

Comments

@mbostock
Copy link
Member

mbostock commented Dec 1, 2020

It’d be nice if this

d3.sort(array, d => d.value)

were shorthand for this

d3.sort(array, (a, b) => d3.ascending(a.value, b.value))

though where the accessor is only evaluated once (in case of non-determinism). We already do something similar for d3.bisector so this seems reasonable!

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

Successfully merging a pull request may close this issue.

1 participant