From d49db986f8fa5fd9bc71240ef8043064d3c00e2b Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Sat, 5 Sep 2026 08:53:19 +0800 Subject: [PATCH] refactor(core): simplify parsers with Array.from map function --- packages/core/src/parsers/markdown.mjs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/core/src/parsers/markdown.mjs b/packages/core/src/parsers/markdown.mjs index 97fa20bc7..05286013f 100644 --- a/packages/core/src/parsers/markdown.mjs +++ b/packages/core/src/parsers/markdown.mjs @@ -22,9 +22,7 @@ const NODE_LTS_VERSION_REGEX = /Long Term Support/i; export const parseChangelog = async path => { const changelog = await loadFromURL(path); - const nodeMajors = Array.from(changelog.matchAll(NODE_VERSIONS_REGEX)); - - return nodeMajors.map(match => ({ + return Array.from(changelog.matchAll(NODE_VERSIONS_REGEX), match => ({ version: coerce(match[1]), isLts: NODE_LTS_VERSION_REGEX.test(match[2]), })); @@ -43,7 +41,8 @@ export const parseIndex = async path => { const index = await loadFromURL(path); - const items = Array.from(index.matchAll(LIST_ITEM_REGEX)); - - return items.map(([, section, api]) => ({ section, api })); + return Array.from(index.matchAll(LIST_ITEM_REGEX), ([, section, api]) => ({ + section, + api, + })); };