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

Function compareRecords

packages/effect/src/Equal.ts:340–358  ·  view source on GitHub ↗
(
  self: Record<PropertyKey, unknown>,
  that: Record<PropertyKey, unknown>
)

Source from the content-addressed store, hash-verified

338}
339
340function compareRecords(
341 self: Record<PropertyKey, unknown>,
342 that: Record<PropertyKey, unknown>
343): boolean {
344 const selfKeys = getAllObjectKeys(self)
345 const thatKeys = getAllObjectKeys(that)
346
347 if (selfKeys.size !== thatKeys.size) {
348 return false
349 }
350
351 for (const key of selfKeys) {
352 if (!(thatKeys.has(key)) || !compareBoth(self[key], that[key])) {
353 return false
354 }
355 }
356
357 return true
358}
359
360/** @internal */
361export function makeCompareMap<K, V>(keyEquivalence: Equivalence<K>, valueEquivalence: Equivalence<V>) {

Callers 1

compareObjectsFunction · 0.85

Calls 3

getAllObjectKeysFunction · 0.90
compareBothFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected