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