MCPcopy Create free account
hub / github.com/arktypeio/arktype / constrainIntersection

Function constrainIntersection

ark/sets/roots/intersection.ts:92–111  ·  view source on GitHub ↗
(
	l: Intersection.Node,
	inner: Intersection.Inner,
	$: BaseScope
)

Source from the content-addressed store, hash-verified

90 [...nodes].sort((l, r) => l.rule.valueOf() - r.rule.valueOf())
91
92export const constrainIntersection = (
93 l: Intersection.Node,
94 inner: Intersection.Inner,
95 $: BaseScope
96): BaseRoot | Disjoint => {
97 const result = intersectIntersections(l.inner, inner, {
98 $,
99 invert: false,
100 pipe: false
101 })
102 if (result instanceof Disjoint) return result
103 return (
104 $ark.sets!.disjointOf?.(result) ??
105 ((
106 l.equals(result) && listsKeysAlike(l, result) && sameBoundUnits(l, result)
107 ) ?
108 l
109 : result)
110 )
111}
112
113const intersectIntersections = (
114 l: Intersection.Inner,

Callers

nothing calls this directly

Calls 5

listsKeysAlikeFunction · 0.90
sameBoundUnitsFunction · 0.90
intersectIntersectionsFunction · 0.85
disjointOfMethod · 0.80
equalsMethod · 0.65

Tested by

no test coverage detected