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

Function pathAt

ark/util/path.ts:91–102  ·  view source on GitHub ↗
(
	path: PropertyKey[],
	key?: PropertyKey
)

Source from the content-addressed store, hash-verified

89
90// one or two keys are copied as a literal, which TurboFan allocates inline
91export const pathAt = (
92 path: PropertyKey[],
93 key?: PropertyKey
94): PropertyKey[] => {
95 if (key !== undefined) path.push(key)
96 const copy =
97 path.length === 1 ? [path[0]]
98 : path.length === 2 ? [path[0], path[1]]
99 : path.slice()
100 if (key !== undefined) path.pop()
101 return copy
102}

Callers 5

issueAtFunction · 0.90
nodeErrorMethod · 0.90
_atMethod · 0.90
errorFromNodeAtFunction · 0.90
errorFromUnionFunction · 0.90

Calls 2

popMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected