From 0976105138ccb335f573375c17a80912f9826d0e Mon Sep 17 00:00:00 2001 From: morning-start Date: Sat, 26 Jul 2025 23:00:52 +0800 Subject: [PATCH] =?UTF-8?q?refactor(zaimanhua):=20=E7=AE=80=E5=8C=96=20par?= =?UTF-8?q?seJsonComic=20=E6=96=B9=E6=B3=95=E4=B8=AD=E7=9A=84=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E5=88=9B=E5=BB=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 直接使用对象属性初始化 Comic 对象,避免不必要的中间变量 --- zaimanhua.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/zaimanhua.js b/zaimanhua.js index 3383a56..72353d1 100644 --- a/zaimanhua.js +++ b/zaimanhua.js @@ -70,22 +70,13 @@ class ZaiManHua extends ComicSource { * @returns {Comic} */ parseJsonComic(e) { - let cover = e.cover; - let title = e.name; - let id = e.comic_py; - - let subtitle = e.authors; - - let classify = e.types.split("/"); - let description = e.last_update_chapter_name; - return new Comic({ - title, - id, - subtitle, - tags: classify, - cover, - description, + id: e.comic_py, + title: e.name, + subtitle: e.authors, + tags: e.types.split("/"), + cover: e.cover, + description: e.last_update_chapter_name, }); }