# rowComparator (@salmonui/data-grid/engine/sort)

> The rowComparator function of @salmonui/data-grid/engine/sort: Comparator equal to the order sortRowOrder produces for an ascending input: sort keys, then source index. Reads codes and per-code values (and per-code ranks where they exist) without repairing ranks, so an incremental update never pays for rank maintenance: numeric keys compare directly (NaN first, like rank 0); strings compare by rank when both codes are ranked and by the locale collator otherwise (ranks are collator-consistent).

Canonical: https://salmonui.dev/docs/reference/data-grid/engine-sort/rowComparator

```ts
import { rowComparator } from '@salmonui/data-grid/engine/sort';
```

Entry index: https://salmonui.dev/docs/reference/data-grid/engine-sort (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/data-grid/engine-sort.md).

## Reference

Kind: function

```ts
function rowComparator<Row>(rows: readonly Row[], keys: readonly SortKey<Row>[], locale: string): (x: number, y: number) => number;
```

Comparator equal to the order `sortRowOrder` produces for an ascending
input: sort keys, then source index. Reads codes and per-code values (and
per-code ranks where they exist) without repairing ranks, so an incremental
update never pays for rank maintenance: numeric keys compare directly (NaN
first, like rank 0); strings compare by rank when both codes are ranked and
by the locale collator otherwise (ranks are collator-consistent).
