footprintjs - v11.2.0
    Preparing search index...

    Function evaluateFilter

    • Evaluates a Prisma-style filter against scope values.

      A filter with no evaluable conditions ({}, or only denied/non-object keys) returns matched: false. This deliberately INVERTS the Prisma/SQL intuition where where: {} matches everything: in a decision rule, a rule that asserts nothing should never win a branch — "all zero conditions passed" is vacuous truth, and silently routing on it would fabricate decision evidence. Want a catch-all? Use the explicit defaultBranch argument of decide() instead of an empty when.

      An operator outside the supported set (eq, ne, gt, gte, lt, lte, in, notIn) records a failed condition — the rule can never spuriously match through a typo (gte misspelled gle). With dev mode enabled (enableDevMode()), a console warning names the unknown operator and key.

      eq / ne / in / notIn ask for the SAME VALUE (sameValue); gt / gte / lt / lte ask for an ORDER, which holds only between two numbers, two bigints, two strings or two Dates (inOrder). A missing value (null, undefined) is in no order with anything, so an ordered condition on it does not hold.

      Type Parameters

      • T extends object

      Parameters

      • getValueFn: (key: string) => unknown

        Reads a value from scope by key (raw, for comparison)

      • isRedactedFn: (key: string) => boolean

        Checks if a key's ACTUAL value is masked (for evidence display)

      • filter: WhereFilter<T>

        The WhereFilter to evaluate

      • serveThreshold: (key: string, threshold: unknown) => ServedThreshold = ...

        What the row keeps of this threshold, the run's answer as data (RedactionRule · serveThreshold), asked once per condition AFTER that key's read, because that read can be the selected one, and after the rule ran on the real value. Default: the value itself, or a hole when its key is masked.

      Returns { conditions: FilterCondition[]; matched: boolean }

      — matched = all conditions passed