Skip to content

Commit ec337b2

Browse files
Trotttargos
authored andcommitted
tools: replace for loop with map()
Refs: #41406 (comment) Co-authored-by: Tobias Nießen <[email protected]> PR-URL: #41451 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Anto Aravinth <[email protected]>
1 parent fa84353 commit ec337b2

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

tools/doc/allhtml.mjs

+1-5
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,8 @@ all = all.slice(0, apiStart.index + apiStart[0].length) +
101101
fs.writeFileSync(new URL('./all.html', source), all, 'utf8');
102102

103103
// Validate all hrefs have a target.
104-
const ids = new Set();
105104
const idRe = / id="([^"]+)"/g;
106-
const idMatches = all.matchAll(idRe);
107-
for (const match of idMatches) {
108-
ids.add(match[1]);
109-
}
105+
const ids = new Set([...all.matchAll(idRe)].map((match) => match[1]));
110106

111107
const hrefRe = / href="#([^"]+)"/g;
112108
const hrefMatches = all.matchAll(hrefRe);

0 commit comments

Comments
 (0)