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

Function compileDefaultMorph

ark/schema/structure/structure.ts:1825–1835  ·  view source on GitHub ↗
(
	js: NodeCompiler,
	node: BaseNode,
	call: string,
	out: string
)

Source from the content-addressed store, hash-verified

1823
1824// only a default on a node that hasMorph can return TransformErrors
1825const compileDefaultMorph = (
1826 js: NodeCompiler,
1827 node: BaseNode,
1828 call: string,
1829 out: string
1830): NodeCompiler =>
1831 node.hasMorph ?
1832 js
1833 .const("defaulted", call)
1834 .if(`defaulted !== ${out}`, () => js.addMorphErrs("defaulted"))
1835 : js.line(call)
1836
1837const compileDeclaredKeySwitch = (
1838 js: NodeCompiler,

Callers 2

writeDefaultMethod · 0.85
compileDefaultFunction · 0.85

Calls 3

ifMethod · 0.80
constMethod · 0.80
lineMethod · 0.80

Tested by

no test coverage detected