(
options: Array<{ value: T }>,
defaultValue: T,
)
| 28 | |
| 29 | /** Resolve the starting index for a select list from its default value. Pure → testable. */ |
| 30 | export function initialIndex<T extends string>( |
| 31 | options: Array<{ value: T }>, |
| 32 | defaultValue: T, |
| 33 | ): number { |
| 34 | const i = options.findIndex(o => o.value === defaultValue); |
| 35 | return i >= 0 ? i : 0; |
| 36 | } |
| 37 | |
| 38 | /** Visible width of a string: length with ANSI SGR (colour/dim) escapes removed. Pure → testable. */ |
| 39 | export function displayWidth(s: string): number { |
no outgoing calls
no test coverage detected