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

Function deferAliases

ark/schema/parse.ts:264–272  ·  view source on GitHub ↗
(v: unknown, $: BaseScope)

Source from the content-addressed store, hash-verified

262
263// a value holding an alias outside a structure is deferred to an alias of its own
264export const deferAliases = (v: unknown, $: BaseScope): unknown => {
265 if (isArray(v)) {
266 const deferred = v.map(element => deferAliases(element, $))
267 return deferred.some((element, i) => element !== v[i]) ? deferred : v
268 }
269 if (!isNode(v) || !v.topAlias || v.is("alias")) return v
270 nodesById.set(v.id, v)
271 return $.node("alias", { reference: v.id }, { reduced: true })
272}
273
274const noChildren: BaseNode[] = []
275

Callers 3

prop.tsFile · 0.90
widenFunction · 0.90
parseNodeFunction · 0.85

Calls 5

isNodeFunction · 0.90
isMethod · 0.80
nodeMethod · 0.80
mapMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected