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

Function isInlined

ark/type/standalone/combinators.ts:964–984  ·  view source on GitHub ↗
(node: BaseNode)

Source from the content-addressed store, hash-verified

962
963// a small checker declaring nothing is inlined, as gzip shrinks its repeats below a name
964const isInlined = (node: BaseNode): boolean => {
965 let inlined = inlinedByNode.get(node)
966 if (inlined === undefined) {
967 inlinedByNode.set(node, false)
968 const own = combines(node) && !node.isCyclic && ownNodesOf(node)
969 inlined =
970 !!own &&
971 !declaresRef(node) &&
972 !own.some(declaresRef) &&
973 (own.length <= maxInlinedNodes ||
974 // an object reading no other's checker is likely anonymous
975 (own.length <= maxInlinedObjectNodes &&
976 own.every(
977 child =>
978 !child.is("structure") ||
979 child.props.every(prop => isInlined(prop.value))
980 )))
981 inlinedByNode.set(node, inlined)
982 }
983 return inlined
984}
985
986type RuleKind = (typeof ruleFactories)[number]
987

Callers 2

ownNodesOfFunction · 0.85
readCheckerFunction · 0.85

Calls 6

combinesFunction · 0.85
ownNodesOfFunction · 0.85
declaresRefFunction · 0.85
isMethod · 0.80
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected