From ad99b02e74346d423ee9523e19a3f66525e96f99 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Sep 2023 12:32:38 +0000 Subject: [PATCH] style: auto format --- lib/v2/rsshub/transform/sitemap.js | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/v2/rsshub/transform/sitemap.js b/lib/v2/rsshub/transform/sitemap.js index d4f233e84c518e..9fe1fabef69b67 100644 --- a/lib/v2/rsshub/transform/sitemap.js +++ b/lib/v2/rsshub/transform/sitemap.js @@ -15,31 +15,31 @@ module.exports = async (ctx) => { const routeParams = new URLSearchParams(ctx.params.routeParams); const $ = cheerio.load(response.data, { xmlMode: true }); - const rssTitle = routeParams.get('title') ? routeParams.get('title') : ($('urlset url').length && $('urlset url').first().find('loc').text() ? $('urlset url').first().find('loc').text() : 'Sitemap'); + const rssTitle = routeParams.get('title') ? routeParams.get('title') : $('urlset url').length && $('urlset url').first().find('loc').text() ? $('urlset url').first().find('loc').text() : 'Sitemap'; let items; const urls = $('urlset url').toArray(); if (urls && urls.length) { - items = urls.map((item) => { - try { - const title = $(item).find('loc').text() || ''; - const link = $(item).find('loc').text() || ''; - const description = $(item).find('loc').text() || ''; - const pubDate = $(item).find('lastmod').text() || undefined; + items = urls + .map((item) => { + try { + const title = $(item).find('loc').text() || ''; + const link = $(item).find('loc').text() || ''; + const description = $(item).find('loc').text() || ''; + const pubDate = $(item).find('lastmod').text() || undefined; - return { - title, - link, - description, - pubDate, - }; - } catch (e) { - return null; - } - }) - .filter(Boolean); - } - else { + return { + title, + link, + description, + pubDate, + }; + } catch (e) { + return null; + } + }) + .filter(Boolean); + } else { items = []; }