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

Function areValuesEqual

packages/db/src/utils/comparison.ts:243–264  ·  view source on GitHub ↗
(a: any, b: any)

Source from the content-addressed store, hash-verified

241 * Compare two values for equality, with special handling for Uint8Arrays and Buffers
242 */
243export function areValuesEqual(a: any, b: any): boolean {
244 // Fast path for reference equality
245 if (a === b) {
246 return true
247 }
248
249 // Check for Uint8Array/Buffer comparison
250 const aIsUint8Array =
251 (typeof Buffer !== `undefined` && a instanceof Buffer) ||
252 a instanceof Uint8Array
253 const bIsUint8Array =
254 (typeof Buffer !== `undefined` && b instanceof Buffer) ||
255 b instanceof Uint8Array
256
257 // If both are Uint8Arrays, compare by content
258 if (aIsUint8Array && bIsUint8Array) {
259 return areUint8ArraysEqual(a, b)
260 }
261
262 // Different types or not Uint8Arrays
263 return false
264}

Callers 1

Calls 1

areUint8ArraysEqualFunction · 0.85

Tested by

no test coverage detected