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

Method inv

ark/schema/units.ts:640–655  ·  view source on GitHub ↗
(node: BaseNode, opts?: InvokeOptions)

Source from the content-addressed store, hash-verified

638
639 // a one-expression node is written inline
640 override inv(node: BaseNode, opts?: InvokeOptions): string {
641 this.reach(node)
642 const expression =
643 (
644 (opts?.kind ?? this.trav) !== this.trav ||
645 (opts?.arg ?? this.data) !== this.data
646 ) ?
647 undefined
648 : node.is("structure") ?
649 // a structure sharing transformed keys applies them in a call of its own
650 this.trav === "Apply" && node.sharesTfs ?
651 undefined
652 : node.jsConjunction(this)
653 : node.jsExpression?.(this)
654 return expression === undefined ? super.inv(node, opts) : `(${expression})`
655 }
656
657 override traversal(node: BaseNode, kind: TraversalKind): string {
658 this.reach(node)

Callers 15

compileMethod · 0.45
jsApplyMethod · 0.45
compileMethod · 0.45
jsIndiscMethod · 0.45
jsAllowsInBranchFunction · 0.45
invokeTransformFunction · 0.45
compileMethod · 0.45
compileMethod · 0.45
jsExpressionFunction · 0.45
jsConjunctionMethod · 0.45
jsTfMethod · 0.45
allowsFunction · 0.45

Calls 3

reachMethod · 0.95
isMethod · 0.80
jsConjunctionMethod · 0.80

Tested by

no test coverage detected