Infers FilterFieldDefinitions from a sample data row and optional column metadata.
columns
Object.keys(sampleRow)
headerText
firstName
"First Name"
The row object type.
A representative data row (typically the first).
Optional
Optional array of column metadata to constrain and label the fields.
An array of inferred filter field definitions.
const fields = inferFilterFields( { name: "Alice", age: 30, joined: "2024-01-15" },);// → [// { key: "name", label: "Name", type: "string" },// { key: "age", label: "Age", type: "number" },// { key: "joined", label: "Joined", type: "date" },// ] Copy
const fields = inferFilterFields( { name: "Alice", age: 30, joined: "2024-01-15" },);// → [// { key: "name", label: "Name", type: "string" },// { key: "age", label: "Age", type: "number" },// { key: "joined", label: "Joined", type: "date" },// ]
Infers FilterFieldDefinitions from a sample data row and optional column metadata.
Inference strategy
columns(if provided), otherwise fromObject.keys(sampleRow).headerTextwhen available, otherwise humanise the key (firstName→"First Name").