From de3c674bb27266489accffe0d47581ba4ab4c9fd Mon Sep 17 00:00:00 2001 From: Leon Xu Date: Mon, 2 May 2022 21:18:22 -0700 Subject: [PATCH] fix: change to one-liner --- src/util.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/util.js b/src/util.js index 9ae8dc6..7bd52ff 100644 --- a/src/util.js +++ b/src/util.js @@ -1,12 +1,5 @@ export const sortData = (data) => { const sortedData = [...data]; - sortedData.sort((a, b) => { - if (a.cases > b.cases) { - return -1; - } else { - return 1; - } - }); - return sortedData; + return sortedData.sort((a, b) => (a.cases > b.cases ? -1 : 1)); }; \ No newline at end of file