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

Function pathOf

ark/schema/shared/issues.ts:779–791  ·  view source on GitHub ↗
(issue: {
	readonly path: readonly PropertyKey[]
})

Source from the content-addressed store, hash-verified

777 * JSON) is bracketed
778 */
779export const pathOf = (issue: {
780 readonly path: readonly PropertyKey[]
781}): string => {
782 let path = ""
783 for (const k of issue.path) {
784 path +=
785 reportsIndices && typeof k === "number" ? `[${k}]`
786 : bracketsKeys && !/^[$_a-z][\w$]*$/i.test(String(k)) ?
787 `[${JSON.stringify(k) ?? String(k)}]`
788 : (path && ".") + String(k)
789 }
790 return path
791}
792
793/** an issue `lineOf` can format: an `ArkError`, standalone `ArkIssue`, or `PathedIssue` */
794export interface ReadableIssue {

Callers 5

propStringMethod · 0.90
writeListedFunction · 0.90
asTemplatedFunction · 0.90
issueLineOfFunction · 0.70
labeledPathOfFunction · 0.70

Calls 2

StringInterface · 0.85
testMethod · 0.80

Tested by

no test coverage detected