From 1dd70991045e35a853b6444d18871c3abca22ad7 Mon Sep 17 00:00:00 2001 From: karan Date: Mon, 16 Oct 2023 16:18:22 +0530 Subject: [PATCH] refactor: sorting managed Signed-off-by: karan --- src/components/Ecosystem/MemberList.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/Ecosystem/MemberList.tsx b/src/components/Ecosystem/MemberList.tsx index a5f61c1e1..34697db79 100644 --- a/src/components/Ecosystem/MemberList.tsx +++ b/src/components/Ecosystem/MemberList.tsx @@ -39,12 +39,13 @@ const MemberList = () => { const firstName = firstMember?.ecosystemRole?.name; const secondName = secondMember?.ecosystemRole?.name; - if (firstName > secondName) { - return 1; - } else if (secondName > firstName) { - return -1; - } else { - return 0; + switch (true) { + case firstName > secondName: + return 1; + case secondName > firstName: + return -1; + default: + return 0; } }; const sortedMemberList = data?.data?.members?.sort(compareMembers);