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

Function areValuesEqual

packages/db/src/query/predicate-utils.ts:1079–1108  ·  view source on GitHub ↗
(a: any, b: any)

Source from the content-addressed store, hash-verified

1077}
1078
1079function areValuesEqual(a: any, b: any): boolean {
1080 // Simple equality check - could be enhanced for deep object comparison
1081 if (a === b) {
1082 return true
1083 }
1084
1085 // Handle NaN
1086 if (typeof a === `number` && typeof b === `number` && isNaN(a) && isNaN(b)) {
1087 return true
1088 }
1089
1090 // Handle Date objects
1091 if (a instanceof Date && b instanceof Date) {
1092 return a.getTime() === b.getTime()
1093 }
1094
1095 // For arrays and objects, use reference equality
1096 // (In practice, we don't need deep equality for these cases -
1097 // same object reference means same value for our use case)
1098 if (
1099 typeof a === `object` &&
1100 typeof b === `object` &&
1101 a !== null &&
1102 b !== null
1103 ) {
1104 return a === b
1105 }
1106
1107 return false
1108}
1109
1110function areRefsEqual(a: PropRef, b: PropRef): boolean {
1111 if (a.path.length !== b.path.length) {

Callers 6

minusSameFieldPredicatesFunction · 0.70
areExpressionsEqualFunction · 0.70
arrayIncludesWithSetFunction · 0.70
isComparisonSubsetFunction · 0.70
valuesEqualFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected