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

Function registerNodeId

ark/schema/parse.ts:123–128  ·  view source on GitHub ↗
(written: string)

Source from the content-addressed store, hash-verified

121
122// compiled code declares functions by id, so an alias prefix is written as an identifier
123export const registerNodeId = (written: string): NodeId => {
124 const prefix = (idPrefixes[written] ??= idPrefixOf(written))
125 const count = (nodeCountsByPrefix[prefix] ?? 0) + 1
126 nodeCountsByPrefix[prefix] = count
127 return `${prefix}${count}` as NodeId
128}
129
130const idPrefixes: PartialRecord<string, string> = Object.create(null)
131

Callers 6

idMethod · 0.90
instantiateMethod · 0.90
lazilyResolveFunction · 0.90
createParseCtxFunction · 0.90
parse.test.tsFile · 0.90
createNodeFunction · 0.85

Calls 1

idPrefixOfFunction · 0.85

Tested by

no test coverage detected