From 8531041a23cde58b72f48024d2329e7350e988d0 Mon Sep 17 00:00:00 2001 From: neil Date: Fri, 2 Dec 2022 16:06:23 +0800 Subject: [PATCH] lint --- .../SearchPackages/SearchPackages.svelte | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/gui/src/components/SearchPackages/SearchPackages.svelte b/packages/gui/src/components/SearchPackages/SearchPackages.svelte index 64ee27d..afa6a14 100644 --- a/packages/gui/src/components/SearchPackages/SearchPackages.svelte +++ b/packages/gui/src/components/SearchPackages/SearchPackages.svelte @@ -23,18 +23,20 @@ const searchLimit = 5; const setPackages = (pkgs: GUIPackage[], isSearch?: boolean) => { - packages = isSearch ? pkgs : pkgs.sort((a, b) => { - if (sortBy === 'popularity') { - const aPop = +a.dl_count + a.installs; - const bPop = +b.dl_count + b.installs; - return sortDirection === 'asc' ? aPop - bPop : bPop - aPop; - } else { - // most recent - const aDate = new Date(a.last_modified); - const bDate = new Date(b.last_modified); - return sortDirection === 'asc' ? +aDate - +bDate : +bDate - +aDate; - } - }); + packages = isSearch + ? pkgs + : pkgs.sort((a, b) => { + if (sortBy === 'popularity') { + const aPop = +a.dl_count + a.installs; + const bPop = +b.dl_count + b.installs; + return sortDirection === 'asc' ? aPop - bPop : bPop - aPop; + } else { + // most recent + const aDate = new Date(a.last_modified); + const bDate = new Date(b.last_modified); + return sortDirection === 'asc' ? +aDate - +bDate : +bDate - +aDate; + } + }); }; packagesStore.subscribe((v) => {