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

Function include

ark/schema/node.ts:769–787  ·  view source on GitHub ↗
(node: BaseNode)

Source from the content-addressed store, hash-verified

767 const collected = new Map<string, BaseNode>()
768 let replaced = false
769 const include = (node: BaseNode): void => {
770 if (replaced || node.c.byId) {
771 const references = node.byId
772 if (node.c.replacedRefs) replaced = true
773 for (const id in references) {
774 const included = collected.get(id)
775 if (included !== undefined && included !== references[id])
776 replaced = true
777 collected.set(id, references[id])
778 }
779 return
780 }
781 const included = collected.get(node.id)
782 if (included === node) return
783 if (included !== undefined) replaced = true
784 collected.set(node.id, node)
785 for (let i = 0; i < node.children.length; i++) include(node.children[i])
786 for (const referenced of node.otherRefs) include(referenced)
787 }
788 include(this)
789 this.c.replacedRefs = replaced
790 // without a prototype it's a dictionary, adding no V8 map per unseen id

Callers 4

collectReferencesFunction · 0.70
referencesWithoutCasesFunction · 0.70
resolveReachedAliasesFunction · 0.70

Calls 6

isMethod · 0.80
getMethod · 0.65
setMethod · 0.45
hasMethod · 0.45
addMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected