| 379 | |
| 380 | // Get hooks for a specific event and matcher |
| 381 | export function getHooksForMatcher( |
| 382 | hooksByEventAndMatcher: Record< |
| 383 | HookEvent, |
| 384 | Record<string, IndividualHookConfig[]> |
| 385 | >, |
| 386 | event: HookEvent, |
| 387 | matcher: string | null, |
| 388 | ): IndividualHookConfig[] { |
| 389 | // For events without matchers, hooks are stored with empty string as key |
| 390 | // because the record keys must be strings. |
| 391 | const matcherKey = matcher ?? '' |
| 392 | return hooksByEventAndMatcher[event]?.[matcherKey] ?? [] |
| 393 | } |
| 394 | |
| 395 | // Get metadata for a specific event's matcher |
| 396 | export function getMatcherMetadata( |