(cursor: number, total: number, maxVisible?: number)
| 1 | /** @internal */ |
| 2 | export const entriesToDisplay = (cursor: number, total: number, maxVisible?: number) => { |
| 3 | const max = maxVisible === undefined ? total : maxVisible |
| 4 | let startIndex = Math.min(total - max, cursor - Math.floor(max / 2)) |
| 5 | if (startIndex < 0) { |
| 6 | startIndex = 0 |
| 7 | } |
| 8 | const endIndex = Math.min(startIndex + max, total) |
| 9 | return { startIndex, endIndex } |
| 10 | } |
no outgoing calls
no test coverage detected