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

Function isSubrecordBy

packages/effect/src/Record.ts:1093–1104  ·  view source on GitHub ↗
(equivalence: Equivalence<A>)

Source from the content-addressed store, hash-verified

1091 * @since 2.0.0
1092 */
1093export const isSubrecordBy = <A>(equivalence: Equivalence<A>): {
1094 <K extends string>(that: ReadonlyRecord<K, A>): (self: ReadonlyRecord<K, A>) => boolean
1095 <K extends string>(self: ReadonlyRecord<K, A>, that: ReadonlyRecord<K, A>): boolean
1096} =>
1097 dual(2, <K extends string>(self: ReadonlyRecord<K, A>, that: ReadonlyRecord<K, A>): boolean => {
1098 for (const key of keys(self)) {
1099 if (!has(that, key) || !equivalence(self[key], that[key])) {
1100 return false
1101 }
1102 }
1103 return true
1104 })
1105
1106/**
1107 * Checks whether the first record is a subrecord of the second record.

Callers 2

Record.tsFile · 0.85
makeEquivalenceFunction · 0.85

Calls 2

keysFunction · 0.70
hasFunction · 0.70

Tested by

no test coverage detected