MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / nullsLast

Function nullsLast

console/src/components/Table/tableColumnBuilders.ts:17–30  ·  view source on GitHub ↗
(
  rowA: Row<TData>,
  rowB: Row<TData>,
  columnId: string,
)

Source from the content-addressed store, hash-verified

15 * before "100cc" instead of lexicographically).
16 */
17const nullsLast = <TData>(
18 rowA: Row<TData>,
19 rowB: Row<TData>,
20 columnId: string,
21): number => {
22 const a = rowA.getValue(columnId);
23 const b = rowB.getValue(columnId);
24
25 if (a == null && b == null) return 0;
26 if (a == null) return 1;
27 if (b == null) return -1;
28
29 return String(a).localeCompare(String(b), undefined, { numeric: true });
30};
31
32export const sortingFunctions = {
33 nullsLast,

Callers

nothing calls this directly

Calls 1

StringClass · 0.85

Tested by

no test coverage detected