Skip to content

Commit 2ea3a1c

Browse files
authored
refactor(core): simplify parsers with Array.from map function (#1084)
1 parent 967b264 commit 2ea3a1c

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

‎packages/core/src/parsers/markdown.mjs‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ const NODE_LTS_VERSION_REGEX = /Long Term Support/i;
2222
export const parseChangelog = async path => {
2323
const changelog = await loadFromURL(path);
2424

25-
const nodeMajors = Array.from(changelog.matchAll(NODE_VERSIONS_REGEX));
26-
27-
return nodeMajors.map(match => ({
25+
return Array.from(changelog.matchAll(NODE_VERSIONS_REGEX), match => ({
2826
version: coerce(match[1]),
2927
isLts: NODE_LTS_VERSION_REGEX.test(match[2]),
3028
}));
@@ -43,7 +41,8 @@ export const parseIndex = async path => {
4341

4442
const index = await loadFromURL(path);
4543

46-
const items = Array.from(index.matchAll(LIST_ITEM_REGEX));
47-
48-
return items.map(([, section, api]) => ({ section, api }));
44+
return Array.from(index.matchAll(LIST_ITEM_REGEX), ([, section, api]) => ({
45+
section,
46+
api,
47+
}));
4948
};

0 commit comments

Comments
 (0)