MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / defaultGetRowKey

Function defaultGetRowKey

packages/core/src/widgets/useTable.ts:49–55  ·  view source on GitHub ↗
(row: T, index: number)

Source from the content-addressed store, hash-verified

47type RecordLike = Readonly<{ id?: unknown }> & Record<string, unknown>;
48
49function defaultGetRowKey<T>(row: T, index: number): string {
50 const record = row as RecordLike;
51 const maybeId = record.id;
52 if (typeof maybeId === "string" && maybeId.length > 0) return maybeId;
53 if (typeof maybeId === "number") return String(maybeId);
54 return String(index);
55}
56
57function getSortValue<T>(row: T, key: string): unknown {
58 const record = row as RecordLike;

Callers 1

useTableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected