MCPcopy Create free account
hub / github.com/TanStack/db / hashPlainObject

Function hashPlainObject

packages/db-ivm/src/hashing/hash.ts:138–152  ·  view source on GitHub ↗
(input: object, marker: number)

Source from the content-addressed store, hash-verified

136}
137
138function hashPlainObject(input: object, marker: number): number {
139 const hasher = new MurmurHashStream()
140
141 // Mark the type of the input
142 hasher.update(marker)
143 const keys = Object.keys(input)
144 keys.sort(keySort)
145 for (const key of keys) {
146 hasher.update(KEY)
147 hasher.update(key)
148 updateHasher(hasher, input[key as keyof typeof input])
149 }
150
151 return hasher.digest()
152}
153
154function updateHasher(hasher: Hasher, input: unknown): void {
155 if (input === null) {

Callers 1

hashObjectFunction · 0.85

Calls 4

updateMethod · 0.95
digestMethod · 0.95
updateHasherFunction · 0.85
keysMethod · 0.45

Tested by

no test coverage detected