Skip to content

CreateCompoundFilter

cartographer


cartographer / createCompoundFilter

createCompoundFilter(_settings, filters): (item) => boolean

Defined in: queries/queryFunctions.ts:111

Build a filter predicate from an array of filter specifications.

Returns a predicate function that checks all filter conditions using AND logic. Supports equals, contains (array/string), range (numeric), and text (case-insensitive substring) matching.

DatacoreSettings

Datacore settings (for future schema context)

object[]

Array of filter specifications with field, type, and value

  • Predicate function that returns true if all filters match

(item): boolean

CatalogItem

boolean

const predicate = createCompoundFilter(settings, [
{ field: 'catalog-status', type: 'equals', value: 'approved' },
{ field: 'word-count', type: 'range', value: [5000, 50000] },
{ field: 'title', type: 'text', value: 'Cthulhu' }
]);
const results = items.filter(predicate);