From 3f374303a4481e5a749a3845c03f0e0d8286a091 Mon Sep 17 00:00:00 2001 From: Zynh0722 Date: Tue, 2 Apr 2024 20:21:55 -0700 Subject: [PATCH] formatting --- index.ts | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/index.ts b/index.ts index 9035a8e..770df5f 100644 --- a/index.ts +++ b/index.ts @@ -12,28 +12,28 @@ async function getPatchHrefs() { } } - return ( - await Promise.all( - [...Array(7).keys()] - .map((val) => ++val) - .map((page) => { - return (async () => { - const req = await fetch(getGalleryPageHref(page)); - const data = parse(await req.text()); + const hrefRequests = [...Array(7).keys()] + .map((val) => ++val) + .map((page) => { + return (async () => { + const req = await fetch(getGalleryPageHref(page)); + const data = parse(await req.text()); - const gallery = data - .getElementsByTagName("div") - .filter((el) => el.classList.contains("hds-gallery-items")) - .shift(); + const gallery = data + .getElementsByTagName("div") + .filter((el) => el.classList.contains("hds-gallery-items")) + .shift(); - return gallery - ?.getElementsByTagName("a") - .map((el) => el.getAttribute("href")) - .filter((el) => el) as string[]; - })(); - }), - ) - ).flat(); + return gallery + ?.getElementsByTagName("a") + .map((el) => el.getAttribute("href")) + .filter((el) => el) as string[]; + })(); + }); + + const hrefLists = await Promise.all(hrefRequests); + + return hrefLists.flat(); } const allPatches = await getPatchHrefs();