From 0f7941459da94dae5be08338643c3ac8d7d56654 Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Tue, 30 Jul 2024 13:07:46 -0700 Subject: [PATCH] Small update to use the _first_ @ rather than the last for username truncation --- src/components/instantlaunches/functions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/instantlaunches/functions.js b/src/components/instantlaunches/functions.js index cc7a28c83..0845009c0 100644 --- a/src/components/instantlaunches/functions.js +++ b/src/components/instantlaunches/functions.js @@ -1,11 +1,11 @@ /** - * Removes a suffix from the username. Everything after the last '@' will be removed. + * Removes a suffix from the username. Everything starting from the first '@' will be removed. * * @param {string} username - The username that will be shortened * @returns {string} - The shortened username */ export const shortenUsername = (username) => { - const atIndex = username.lastIndexOf("@"); + const atIndex = username.indexOf("@"); if (atIndex > -1) { return username.slice(0, atIndex); }