MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / initialIndex

Function initialIndex

src/setup/prompt.ts:30–36  ·  view source on GitHub ↗
(
  options: Array<{ value: T }>,
  defaultValue: T,
)

Source from the content-addressed store, hash-verified

28
29/** Resolve the starting index for a select list from its default value. Pure → testable. */
30export 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. */
39export function displayWidth(s: string): number {

Callers 2

chooseInteractiveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected