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

Function stringifyPath

ark/aot/util.ts:58–67  ·  view source on GitHub ↗
(path: readonly PropertyKey[])

Source from the content-addressed store, hash-verified

56 : String(data)
57
58export const stringifyPath = (path: readonly PropertyKey[]): string => {
59 let result = ""
60 for (const segment of path) {
61 if (typeof segment === "string" && /^[$A-Z_a-z][\w$]*$/.test(segment))
62 result += result ? `.${segment}` : segment
63 else
64 result += `[${typeof segment === "string" ? JSON.stringify(segment) : String(segment)}]`
65 }
66 return result
67}
68
69export const editsBetween = (a: string, b: string): number => {
70 if (Math.abs(a.length - b.length) > 2) return 3

Callers 12

validateFunction · 0.90
withAlikeFunction · 0.90
writeTextFunction · 0.90
formatFlatPathFunction · 0.90
typePathToPropStringFunction · 0.90
writeInEnFunction · 0.90
propStringOfFunction · 0.90
describeReasonsMethod · 0.90
undeclaredHintMethod · 0.90
writeErrorFunction · 0.90
writeAtPathsFunction · 0.90
issues.test.tsFile · 0.90

Calls 2

StringInterface · 0.85
testMethod · 0.80

Tested by 1

withAlikeFunction · 0.72