MCPcopy Create free account
hub / github.com/SvelteStack/svelte-query / stableValueHash

Function stableValueHash

src/queryCore/core/utils.ts:301–312  ·  view source on GitHub ↗
(value: any)

Source from the content-addressed store, hash-verified

299 * Hashes the value into a stable hash.
300 */
301export function stableValueHash(value: any): string {
302 return JSON.stringify(value, (_, val) =>
303 isPlainObject(val)
304 ? Object.keys(val)
305 .sort()
306 .reduce((result, key) => {
307 result[key] = val[key]
308 return result
309 }, {} as any)
310 : val
311 )
312}
313
314/**
315 * Checks if key `b` partially matches with key `a`.

Callers 1

hashQueryKeyFunction · 0.85

Calls 1

isPlainObjectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…