Skip to main content

Function: withFilterIdentity()

function withFilterIdentity<T>(filter, identity): T;

Defined in: packages/client/src/core/sync/filter-identity.ts:39

Replaces a filter's toString with a stable, configuration-derived identity.

Type Parameters

Type Parameter
T extends (...args) => any

Parameters

ParameterTypeDescription
filterTThe filter function to stamp.
identitystringA string that changes if and only if the filter's behaviour does.

Returns

T

The same function, stamped.

Example

const filter = withFilterIdentity(
(doc) => doc["~class"] !== "Draft",
describeFilter("app", { exclude: ["Draft"] })
);
String(filter); // "docstack-filter/1:app:{\"exclude\":[\"Draft\"]}"