Expand description
Table sorting, ported from upstream’s table.ts.
Numbers compare numerically when both values parse, after removing grouping
separators, so “9, 10, 100” and “12,480” sort as numbers. Other text compares
naturally (digit runs by value) and without regard to case. Upstream uses the
browser’s Intl.Collator in the table’s language for text; this port has no locale
tailoring, so give accented or locale-sensitive columns an explicit sort key.
Enums§
- Sort
Direction - Which way a column is sorted.
Functions§
- as_
number - A value as a number, ignoring spaces and commas used for grouping.
- compare
- Compare two sort keys as
table.tsdoes: numerically when both are numbers. - next_
direction - The direction a header press picks: a column sorted ascending flips to descending, anything else starts ascending.
- order
- Indices of
keysin sorted order. Stable: equal keys keep their order, so sorting by one column after another groups within the earlier order.