Skip to content

textField

const textField: <Row>(input) => MemoryFieldSpec<Row>;

Defined in: filters/memory.ts:106

Allow-list a public field as a text filter over a row value read by path (a key, a dot path, or a getter). contains/startsWith/endsWith match the input literally and ignore case; like/ilike/notIlike take a SQL pattern (%, _, \ escapes). How case is folded follows dialect (see MemoryDialect).

Type Parameter Default type
Row any
Parameter Type
input { path: MemoryAccessor<Row>; }
input.path MemoryAccessor<Row>

MemoryFieldSpec<Row>

import { buildFilterPredicate, textField } from "@xtandard/lib/filters/memory";
const { predicate } = buildFilterPredicate({
spec: { city: textField({ path: "address.city" }) },
filters: [{ field: "city", filter: { kind: "text", operator: "contains", value: "LIM" } }],
});
predicate({ address: { city: "Lima" } }); // → true
predicate({ address: null }); // → false