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

Function Struct

packages/effect/src/Equivalence.ts:691–701  ·  view source on GitHub ↗
(
  fields: R
)

Source from the content-addressed store, hash-verified

689 * @since 4.0.0
690 */
691export function Struct<R extends Record<string, Equivalence<any>>>(
692 fields: R
693): Equivalence<{ readonly [K in keyof R]: [R[K]] extends [Equivalence<infer A>] ? A : never }> {
694 const keys: Array<any> = Reflect.ownKeys(fields)
695 return make((self, that) => {
696 for (const key of keys) {
697 if (!fields[key](self[key], that[key])) return false
698 }
699 return true
700 })
701}
702
703/**
704 * Creates an equivalence for objects by comparing all properties using the same equivalence.

Callers

nothing calls this directly

Calls 1

makeFunction · 0.70

Tested by

no test coverage detected