Table.FilterFn

Generated from docs.json. 32 exposed values, types, and type aliases, in the order the module exposes them.

Built-in filter functions, ported from column-filtering/filterFns.ts.

A FilterFn is a comparison between a cell value and a filter value plus three helpers that TanStack attaches to every filter fn:

  • resolveFilterValue normalises the filter value once per filter before any row is tested (the table does this, not filter).
  • resolveDataValue normalises the cell value before comparison (filter does this).
  • autoRemove says when a filter value is blank enough that the filter should be dropped from state.

Type

FilterFn

type FilterFn

A filter comparison with its resolvers.

Basic

equals

equals : Table.FilterFn.FilterFn

Strict equality.

weakEquals

weakEquals : Table.FilterFn.FilterFn

Loose equality ("1" == 1).

Strings

includesString

includesString : Table.FilterFn.FilterFn

Case-insensitive substring match.

includesStringSensitive

includesStringSensitive : Table.FilterFn.FilterFn

Case-sensitive substring match.

equalsString

equalsString : Table.FilterFn.FilterFn

Case-insensitive string equality.

equalsStringSensitive

equalsStringSensitive : Table.FilterFn.FilterFn

Case-sensitive string equality.

startsWith

startsWith : Table.FilterFn.FilterFn

Case-insensitive prefix match.

endsWith

endsWith : Table.FilterFn.FilterFn

Case-insensitive suffix match.

Blank

empty

empty : Table.FilterFn.FilterFn

Keeps blank cells. The filter value is only an on/off flag.

notEmpty

notEmpty : Table.FilterFn.FilterFn

Keeps non-blank cells. The filter value is only an on/off flag.

Numbers

greaterThan

greaterThan : Table.FilterFn.FilterFn

Numeric when both sides parse as numbers, string comparison otherwise.

greaterThanOrEqualTo

greaterThanOrEqualTo : Table.FilterFn.FilterFn

lessThan

lessThan : Table.FilterFn.FilterFn

lessThanOrEqualTo

lessThanOrEqualTo : Table.FilterFn.FilterFn

Ranges

between

between : Table.FilterFn.FilterFn

Exclusive range; the filter value is List [ min, max ].

betweenInclusive

betweenInclusive : Table.FilterFn.FilterFn

Inclusive range; the filter value is List [ min, max ].

inNumberRange

inNumberRange : Table.FilterFn.FilterFn

Inclusive numeric range; only Number cells can match.

inDateRange

inDateRange : Table.FilterFn.FilterFn

Inclusive date range on Date cells (or timestamps, or YYYY-MM-DD strings).

Arrays

arrHas

arrHas : Table.FilterFn.FilterFn

Scalar cell equals at least one of the filter values.

arrIncludes

arrIncludes : Table.FilterFn.FilterFn

List or String cell includes at least one filter value.

arrIncludesAll

arrIncludesAll : Table.FilterFn.FilterFn

List cell includes every filter value.

arrIncludesSome

arrIncludesSome : Table.FilterFn.FilterFn

List cell includes at least one filter value.

Building your own

custom

custom : (Table.Value.Value -> Table.Value.Value -> Bool) -> Table.FilterFn.FilterFn

Build a filter fn from a comparison. Resolvers default to identity and autoRemove defaults to removing Null and the empty string.

withResolveFilterValue

withResolveFilterValue : (Table.Value.Value -> Table.Value.Value) -> Table.FilterFn.FilterFn -> Table.FilterFn.FilterFn

Replace the filter-value normaliser.

withResolveDataValue

withResolveDataValue : (Table.Value.Value -> Table.Value.Value) -> Table.FilterFn.FilterFn -> Table.FilterFn.FilterFn

Replace the cell-value normaliser.

withAutoRemove

withAutoRemove : (Table.Value.Value -> Bool) -> Table.FilterFn.FilterFn -> Table.FilterFn.FilterFn

Replace the auto-remove predicate.

Applying

filter

filter : Table.FilterFn.FilterFn -> Table.Value.Value -> Table.Value.Value -> Bool

Test a raw cell value against an already resolved filter value. The cell value is passed through resolveDataValue first; the filter value is not (resolve it once with resolveFilterValue).

resolveFilterValue

resolveFilterValue : Table.FilterFn.FilterFn -> Table.Value.Value -> Table.Value.Value

Normalise a filter value.

resolveDataValue

resolveDataValue : Table.FilterFn.FilterFn -> Table.Value.Value -> Table.Value.Value

Normalise a cell value.

autoRemove

autoRemove : Table.FilterFn.FilterFn -> Table.Value.Value -> Bool

Should this filter value cause the filter to be dropped?

Dates

toDateTimestamp

toDateTimestamp : Table.Value.Value -> Float

toDateTimestamp from filterFns.ts: a Date gives its milliseconds, a Number passes through, and everything else that is not a parseable date string gives NaN, which never falls inside a range.

Elm has no new Date(string), so the string form is limited to ISO 8601 YYYY-MM-DD, optionally followed by THH:MM, THH:MM:SS and a Z.