(params: {
modelIds: readonly string[]
focusedId: string
direction: FreebuffModelNavigationDirection
})
| 10 | ]) |
| 11 | |
| 12 | export function nextFreebuffModelId(params: { |
| 13 | modelIds: readonly string[] |
| 14 | focusedId: string |
| 15 | direction: FreebuffModelNavigationDirection |
| 16 | }): string | null { |
| 17 | const { modelIds, focusedId, direction } = params |
| 18 | if (modelIds.length === 0) return null |
| 19 | |
| 20 | const currentIdx = modelIds.indexOf(focusedId) |
| 21 | if (currentIdx === -1) return modelIds[0] ?? null |
| 22 | |
| 23 | const step = direction === 'forward' ? 1 : -1 |
| 24 | return modelIds[(currentIdx + step + modelIds.length) % modelIds.length] |
| 25 | } |
| 26 | |
| 27 | export function freebuffModelNavigationDirectionForKey(key: { |
| 28 | name?: string |
no outgoing calls
no test coverage detected