observablehq / stdlib

The Observable standard library.
https://observablehq.com/@observablehq/standard-library
ISC License
957 stars 83 forks source link

Update __table sorting to handle missing values #338

Closed annie closed 1 year ago

annie commented 1 year ago

Resolves https://github.com/observablehq/observablehq/issues/9498

Cribbed ascendingDefined from d3.sort (it's not exported).

I'm a bit on the fence about whether or not missing values should be sorted first when the order is descending 🤔 but perhaps we can try it this way and see what people think?

annie commented 1 year ago

oookay after some more testing, i started to agree with @mbostock that sorting nulls at the end felt more intuitive, so i updated the PR to do that. let's see what people think!

annie commented 1 year ago

@mbostock would you mind taking another look at this? 🙏 i changed the implementation slightly to sort nulls at the end.