Function: stableMemberKey()
stableMemberKey(
input):string
Defined in: packages/core/src/family.ts:173
Stable stringify: JSON with object keys sorted at every level, so two inputs that differ only in key order produce the same member key. Arrays keep their order — order is meaning there.
Throws on anything it cannot key faithfully. This function is the
default derivation of an identity — the member key is embedded in the
bot's instance id and is what an override is stored under — so returning a
wrong-but-plausible key is the worst available outcome. Date, Map,
Set and class instances all serialise to {} regardless of their
contents, which silently hands back a different member's bot. Rather than
collapse them, this refuses and names the escape hatch.
Accepted: strings (verbatim), plain objects and arrays of JSON scalars.
Anything else — including numbers, undefined, Date, Map, Set,
BigInt, functions and cyclic structures — needs an explicit
options.key.
Known residual, documented rather than hidden: a string that happens to
spell a JSON object ('{"a":1}') keys the same as {a: 1}. Pass
options.key if a family is keyed by strings that may look like JSON.
Parameters
input
unknown
Returns
string