Concatenate a settings file's `hooks` block into the accumulator, keeping * only known events and well-formed matcher arrays.
(target: HooksConfig, raw: unknown)
| 71 | /** Concatenate a settings file's `hooks` block into the accumulator, keeping |
| 72 | * only known events and well-formed matcher arrays. */ |
| 73 | function mergeHooksInto(target: HooksConfig, raw: unknown): void { |
| 74 | if (!raw || typeof raw !== "object") return |
| 75 | for (const [event, matchers] of Object.entries(raw as Record<string, unknown>)) { |
| 76 | if (!isHookEvent(event)) continue |
| 77 | if (!Array.isArray(matchers)) continue |
| 78 | ;(target[event] ??= []).push(...(matchers as HookMatcher[])) |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | function readJson(filePath: string): Record<string, unknown> | undefined { |
| 83 | try { |
no test coverage detected