Table.SortFn
Generated from docs.json. 12 exposed values, types, and type aliases, in the order the module exposes them.
Built-in sort functions, ported from row-sorting/sortFns.ts.
A SortFn compares two cell values in ascending order. Descending order is
applied by the sorted row model. Each sort fn carries an optional
resolveDataValue normaliser that runs on both values before comparison,
which is how the built-ins lowercase text or turn dates into timestamps.
Type
SortFn
type SortFnAn ascending comparison on cell values plus its value normaliser.
Built-ins
alphanumeric
alphanumeric : Table.SortFn.SortFnNatural sort, case-insensitive: item2 before item10.
alphanumericCaseSensitive
alphanumericCaseSensitive : Table.SortFn.SortFnNatural sort, case-sensitive.
text
text : Table.SortFn.SortFnPlain lexicographic sort, case-insensitive.
textCaseSensitive
textCaseSensitive : Table.SortFn.SortFnPlain lexicographic sort, case-sensitive.
datetime
datetime : Table.SortFn.SortFnChronological sort on Date values (and numeric timestamps).
Date values become millisecond timestamps first; anything else is compared
with JavaScript's relational rules, so two strings compare as strings and
everything else compares numerically.
basic
basic : Table.SortFn.SortFnDirect comparison with no normalisation.
Building your own
custom
custom : (Table.Value.Value -> Table.Value.Value -> Order) -> Table.SortFn.SortFnBuild a sort fn from a comparison. Use withResolveDataValue
to add a normaliser.
withResolveDataValue
withResolveDataValue : (Table.Value.Value -> Table.Value.Value) -> Table.SortFn.SortFn -> Table.SortFn.SortFnReplace the normaliser that runs on both values before comparison.
Applying
compare
compare : Table.SortFn.SortFn -> Table.Value.Value -> Table.Value.Value -> OrderCompare two raw cell values: both are passed through the normaliser, then the comparison runs.
resolveDataValue
resolveDataValue : Table.SortFn.SortFn -> Table.Value.Value -> Table.Value.ValueRun only the normaliser.
Chunking
splitAlphaNumeric
splitAlphaNumeric : String -> List StringThe Elm counterpart of splitting a string with TanStack's
reSplitAlphaNumeric regex (/([0-9]+)/gm): runs of digits become their own
segments, and the empty segments JavaScript leaves at the boundaries are kept.
splitAlphaNumeric "apple" == [ "apple" ]
splitAlphaNumeric "item10" == [ "item", "10", "" ]
splitAlphaNumeric "10abc" == [ "", "10", "abc" ]
splitAlphaNumeric "" == [ "" ]