filterItems
Commons
stable
Filters a list of items against a query string using a configurable filter function. Supports per-key custom filters, key allowlists, and three filter modes: any-key (default), union, every, and intersection.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- itemsrequisreadonly (readonly [item: IInternalItem, transformed: Record<string, unknown>])[] | readonly IInternalItem[]
- The items to filter. Each element is either a plain item or a tuple of [original-item, transformed-item]. The transformed form is used for key lookups.
- queryrequisstring
- The search string to match against. When empty and noFilter is not set, all items are returned.
- options{ customKeyFilter?: TFilterKeyFunctions default?: TFilterFunction filterKeys?: TFilterKeys filterMode?: TFilterMode noFilter?: boolean }
- Optional configuration: customKeyFilter (per-key filter functions), default (fallback filter, defaults to defaultFilter), filterKeys (allowlist of keys to search), filterMode (union | every | intersection), noFilter (bypass filtering).
API
Valeur de retour
La valeur retournée par cet util.
- An array of match objects, each carrying the item's original index and a map of which keys matched (and at what position/value).
Usage
Exemples
Extraits de code prêts à coller.
Filter a list by query