Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
carolineBda committed Sep 26, 2024
1 parent 815ce43 commit 5406536
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const anonymizeUser = (userName: string, userId: string): string => {
if (!userName?.length) return userId.slice(4);
let anonymous = userName[0].toUpperCase();
const spaceIndex = userName.indexOf(" ");
if (spaceIndex && userName.length > spaceIndex) {
if (spaceIndex > 0 && userName.length > spaceIndex) {
anonymous += userName[spaceIndex + 1].toUpperCase();
}
return anonymous;
Expand Down

0 comments on commit 5406536

Please sign in to comment.