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

Function heldThrough

ark/aot/graph.ts:557–563  ·  view source on GitHub ↗
(held: Held, relation: Relation)

Source from the content-addressed store, hash-verified

555type Relation = "self" | "element" | "copy" | "pairs" | "none"
556
557const heldThrough = (held: Held, relation: Relation): Held | undefined =>
558 relation === "self" ? held
559 : relation === "element" ?
560 heldAs(held.depth - 1, Math.max(0, held.copied - 1))
561 : relation === "copy" ? heldAs(held.depth, Math.max(1, held.copied))
562 : relation === "pairs" ? heldAs(held.depth + 1, Math.max(2, held.copied + 1))
563 : undefined
564
565// e.g. `[o]` or `{ o }`
566const wrapperOf = (held: Held): Held => heldAs(held.depth + 1, held.copied + 1)

Callers 3

patternHoldingsOfFunction · 0.85
mayWriteInCallbackMethod · 0.85
mayWriteFromMethod · 0.85

Calls 1

heldAsFunction · 0.85

Tested by

no test coverage detected