All files / src/features/account initial.ts

100% Statements 1/1
100% Branches 2/2
100% Functions 1/1
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6      19x    
/** The first character of a display name, for the round account button. */
export function initialOf(name: string): string {
  // Array.from splits by code point, so an emoji or Å stays whole.
  return (Array.from(name.trim())[0] ?? '').toLocaleUpperCase()
}