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
| Parameter | Type | Description |
|---|---|---|
filter | T | The filter function to stamp. |
identity | string | A 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\"]}"