Function
formatIssuePath
(
path: ReadonlyArray<PropertyKey | StandardSchemaV1.PathSegment> | undefined,
)
Source from the content-addressed store, hash-verified
| 28 | }; |
| 29 | |
| 30 | const formatIssuePath = ( |
| 31 | path: ReadonlyArray<PropertyKey | StandardSchemaV1.PathSegment> | undefined, |
| 32 | ): string => { |
| 33 | if (!path || path.length === 0) { |
| 34 | return "$"; |
| 35 | } |
| 36 | |
| 37 | return path |
| 38 | .map((segment) => |
| 39 | typeof segment === "object" && segment !== null && "key" in segment |
| 40 | ? String(segment.key) |
| 41 | : String(segment), |
| 42 | ) |
| 43 | .join("."); |
| 44 | }; |
| 45 | |
| 46 | const formatIssues = (issues: ReadonlyArray<StandardSchemaV1.Issue>): string => |
| 47 | issues.map((issue) => `${formatIssuePath(issue.path)}: ${issue.message}`).join("; "); |
Tested by
no test coverage detected