```ts
export function rowKey(name: string): string {
  if (typeof name !== 'string') {
    throw new Error('name must be a string');
  }
  return name[0].toUpperCase();
}

export function indexRows(names: string[]): Record<string, string[]> {
  if (!names) {
    return {};
  }

  const indexedNames: Record<string, string[]> = {};

  names.forEach(name => {
    const key = rowKey(name);
    if (key in indexedNames) {
      indexedNames[key].push(name);
    } else {
      indexedNames[key] = [name];
    }
  });

  return indexedNames;
}
```