(issue: {
readonly path: readonly PropertyKey[]
})
| 777 | * JSON) is bracketed |
| 778 | */ |
| 779 | export 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` */ |
| 794 | export interface ReadableIssue { |
no test coverage detected