MCPcopy Create free account
hub / github.com/Effect-TS/effect / compareBoth

Function compareBoth

packages/effect/src/Equal.ts:181–202  ·  view source on GitHub ↗
(self: unknown, that: unknown)

Source from the content-addressed store, hash-verified

179}
180
181function compareBoth(self: unknown, that: unknown): boolean {
182 if (self === that) return true
183 if (self == null || that == null) return false
184 const selfType = typeof self
185 if (selfType !== typeof that) {
186 return false
187 }
188 // Special case for NaN: NaN should be considered equal to NaN
189 if (selfType === "number" && self !== self && that !== that) {
190 return true
191 }
192 if (selfType !== "object" && selfType !== "function") {
193 return false
194 }
195
196 if (byReferenceInstances.has(self) || byReferenceInstances.has(that)) {
197 return false
198 }
199
200 // For objects and functions, use cached comparison
201 return withCache(self, that, compareObjects)
202}
203
204/** Helper to run comparison with proper visited tracking */
205function withVisitedTracking(

Callers 3

equalsFunction · 0.85
compareArraysFunction · 0.85
compareRecordsFunction · 0.85

Calls 2

withCacheFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected