MCPcopy
hub / github.com/arktypeio/arktype / withId

Function withId

ark/schema/parse.ts:309–322  ·  view source on GitHub ↗
(node: node, id: NodeId)

Source from the content-addressed store, hash-verified

307}
308
309export const withId = <node extends BaseNode>(node: node, id: NodeId): node => {
310 if (node.id === id) return node
311 if (isNode(nodesByRegisteredId[id]))
312 throwInternalError(`Unexpected attempt to overwrite node id ${id}`)
313 // have to ignore cache to force creation of new potentially cyclic id
314 return createNode({
315 id,
316 kind: node.kind,
317 inner: node.inner,
318 meta: node.meta,
319 $: node.$,
320 ignoreCache: true
321 }) as never
322}
323
324export const withMeta = <node extends BaseNode>(
325 node: node,

Callers 1

parseDefinitionFunction · 0.90

Calls 3

isNodeFunction · 0.90
throwInternalErrorFunction · 0.90
createNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…