MCPcopy Index your code
hub / github.com/AnswerOverflow/AnswerOverflow / getInitials

Function getInitials

packages/ui/src/utils/avatars.tsx:1–6  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

1export function getInitials(name: string) {
2 const onlyLetters = name.replace(/[^a-zA-Z ]/g, '').toUpperCase();
3 const words = onlyLetters.split(' ');
4 const initials = words.map((word) => word[0]);
5 return initials.join('').slice(0, 3);
6}

Callers 3

ServerIconFunction · 0.90
UserAvatarFunction · 0.90
ContentsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected