enumField
const enumField: <Row>(input) => MemoryFieldSpec<Row>;Defined in: filters/memory.ts:141
Allow-list a public field as an enum filter (eq/ne/inArray/notInArray/null checks)
over a row value read by path. As in SQL, ne and notInArray never match a NULL.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Row |
any |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
{ path: MemoryAccessor<Row>; } |
input.path |
MemoryAccessor<Row> |
Returns
Section titled “Returns”MemoryFieldSpec<Row>
Example
Section titled “Example”import { buildFilterPredicate, enumField } from "@xtandard/lib/filters/memory";
const { predicate } = buildFilterPredicate({ spec: { status: enumField({ path: "status" }) }, filters: [{ field: "status", filter: { kind: "enum", operator: "notInArray", values: ["done"] } }],});predicate({ status: "open" }); // → truepredicate({ status: null }); // → false (NULL NOT IN (…) is UNKNOWN)