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

Function pipeMorphed

ark/sets/intersections.ts:227–243  ·  view source on GitHub ↗
(
	from: nodeOfKind<RootKind>,
	to: nodeOfKind<RootKind>,
	ctx: IntersectionContext
)

Source from the content-addressed store, hash-verified

225 : _intersectNodes(l, r, ctx)
226
227const pipeMorphed = (
228 from: nodeOfKind<RootKind>,
229 to: nodeOfKind<RootKind>,
230 ctx: IntersectionContext
231) =>
232 from.distribute(
233 fromBranch => _pipeMorphed(fromBranch, to, ctx),
234 results => {
235 const viableBranches = results.filter(
236 isNode as TypeGuard<unknown, Morph.Node>
237 )
238
239 return viableBranches.length === 0 ?
240 Disjoint.init("union", from.branches, to.branches)
241 : ctx.$.node("union", { branches: viableBranches })
242 }
243 )
244
245const _pipeMorphed = (
246 from: Union.ChildNode,

Callers 1

_pipeNodesFunction · 0.85

Calls 5

_pipeMorphedFunction · 0.85
distributeMethod · 0.80
filterMethod · 0.80
initMethod · 0.80
nodeMethod · 0.80

Tested by

no test coverage detected