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

Function disjointInputsOf

ark/sets/intersections.ts:155–169  ·  view source on GitHub ↗
(
	l: BaseNode,
	r: BaseNode,
	ctx: IntersectionContext
)

Source from the content-addressed store, hash-verified

153// but are compared wherever two meet, which can be at a key intersected
154// before the one the inputs are disjoint at
155const disjointInputsOf = (
156 l: BaseNode,
157 r: BaseNode,
158 ctx: IntersectionContext
159): Disjoint | undefined => {
160 if (!l.isRoot() || !r.isRoot()) return
161 if (!(l.hasMorph && r.hasMorph) && !reachesDefault(l) && !reachesDefault(r))
162 return
163 const lIn = unreadInputOf(l)
164 const rIn = lIn && unreadInputOf(r)
165 // the operands are compared as they are while an input of theirs is read
166 if (!lIn || !rIn || (lIn === l && rIn === r)) return
167 const inputs = intersectOrPipeNodes(lIn, rIn, ctx)
168 if (inputs instanceof Disjoint) return inputs
169}
170
171// equal nodes can list their outputs' keys in different orders
172export const listsKeysAlike = (l: BaseNode, r: BaseNode): boolean =>

Callers 1

intersections.tsFile · 0.85

Calls 2

reachesDefaultFunction · 0.90
unreadInputOfFunction · 0.85

Tested by

no test coverage detected