Skip to main content

filterFieldsByComparator()

filterFieldsByComparator(field: FullField<string, string, string, Option<string>, Option<string>>, fields: OptionList<FullField<string, string, string, Option<string>, Option<string>>>, operator: string): FullField<string, string, string, Option<string>, Option<string>>[] | { label: string; options: WithUnknownIndex<FullField<string, string, string, Option<string>, Option<string>>>[]; }[]

For a given FullField, returns the fields list filtered for other fields that match by comparator. Only fields other than the one in question will ever be included, even if comparator is null or undefined. If comparator is a string, fields with the same value for that property will be included. If comparator is a function, each field will be passed to the function along with the operator and fields for which the function returns true will be included.

Parameters

ParameterTypeDescription
fieldFullField<string, string, string, Option<string>, Option<string>>The field in question.
fieldsOptionList<FullField<string, string, string, Option<string>, Option<string>>>The full FullField list to be filtered.
operatorstring-

Returns

FullField<string, string, string, Option<string>, Option<string>>[] | { label: string; options: WithUnknownIndex<FullField<string, string, string, Option<string>, Option<string>>>[]; }[]

Defined in

packages/react-querybuilder/src/utils/filterFieldsByComparator.ts:25


caution

API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.