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

Function decodePointerSegment

ark/sets/fromJsonSchema.ts:577–590  ·  view source on GitHub ↗
(
	segment: string,
	ref: string,
	refPointer: string
)

Source from the content-addressed store, hash-verified

575}
576
577const decodePointerSegment = (
578 segment: string,
579 ref: string,
580 refPointer: string
581): string => {
582 let decoded: string
583 try {
584 decoded = decodeURIComponent(segment)
585 } catch {
586 // a malformed escape like %ZZ names no key
587 return throwParseError(writeUnresolvableRefMessage(ref, refPointer))
588 }
589 return decoded.replace(/~1/g, "/").replace(/~0/g, "~")
590}
591
592// the base URI of a document without an absolute $id
593const documentUri = "arksets:/document"

Callers 2

cycleDefNameOfFunction · 0.85
resolvePointerFunction · 0.85

Calls 3

throwParseErrorFunction · 0.90
replaceMethod · 0.80

Tested by

no test coverage detected