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

Function invokeTransform

ark/schema/roots/union.ts:896–905  ·  view source on GitHub ↗
(
	js: NodeCompiler,
	branch: BaseRoot,
	member?: BaseRoot
)

Source from the content-addressed store, hash-verified

894
895// a branch whose transform doesn't require ctx returns its errors rather than adding them
896const invokeTransform = (
897 js: NodeCompiler,
898 branch: BaseRoot,
899 member?: BaseRoot
900): string =>
901 member ?
902 `${js.ref(transformResolution)}(ctx, "${js.nameOf(member.id)}", data, ${js.refToId(branch.id, { kind: "Transform" })})`
903 : js.needsCtx && returnsTransformErrors(branch) ?
904 `${js.ref(transformed)}(ctx, ${js.inv(branch)}, data)`
905 : js.inv(branch)
906
907export type CaseKey<kind extends DiscriminantKind = DiscriminantKind> =
908 DiscriminantKind extends kind ? string : DiscriminantKinds[kind] | "default"

Callers 2

compileMethod · 0.85
jsIndiscMethod · 0.85

Calls 5

returnsTransformErrorsFunction · 0.90
refToIdMethod · 0.65
refMethod · 0.45
nameOfMethod · 0.45
invMethod · 0.45

Tested by

no test coverage detected