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

Function issueLineOf

ark/schema/shared/issues.ts:840–864  ·  view source on GitHub ↗
(issue: ReadableIssue)

Source from the content-addressed store, hash-verified

838
839/** @internal formats a standalone issue as its line in `errors.summary` */
840export const issueLineOf = (issue: ReadableIssue): string => {
841 const defaultMessage = messageOf(issue)
842 const message = issue.message ?? defaultMessage
843 // every key of a build holding neither an index nor a key to bracket is an
844 // identifier, so its path is its keys joined, and it holds no pathOf
845 const path =
846 reportsIndices || bracketsKeys ? pathOf(issue) : issue.path.join(".")
847 return (
848 listsUnions && (issue as ArkIssue)._l !== undefined ?
849 (issue as ArkIssue)._l!
850 : labelsValues && isLabeledIssue(issue, message, defaultMessage) ?
851 labeledPathOf(issue) + message
852 : path ?
853 path +
854 ((
855 writesText &&
856 !(message === "is invalid" && issue.expected === "valid") &&
857 !message.startsWith(defaultMessage)
858 ) ?
859 ": "
860 : " ") +
861 message
862 : message
863 )
864}
865
866/**
867 * Formats an error as its line in `errors.summary`, e.g.

Callers 7

writeAlikeFunction · 0.90
summaryMethod · 0.90
summaryMethod · 0.90
summaryMethod · 0.70
summaryMethod · 0.70
summaryMethod · 0.70
lineOfFunction · 0.70

Calls 4

messageOfFunction · 0.70
pathOfFunction · 0.70
isLabeledIssueFunction · 0.70
labeledPathOfFunction · 0.70

Tested by

no test coverage detected