fix: change to one-liner

This commit is contained in:
Leon Xu committed 2022-05-02 21:18:22 -07:00
1 parent ff97bae9ec
commit de3c674bb2
1 file changed
+1 -8
+1 -8
View File
@@ -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));
};