Skip to content

Commit 4a57d47

Browse files
Trotttargos
authored andcommitted
tools: replace while+exec() with matchAll()
PR-URL: #41406 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 4a369d0 commit 4a57d47

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tools/doc/allhtml.mjs

+4-3
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,13 @@ fs.writeFileSync(new URL('./all.html', source), all, 'utf8');
103103
// Validate all hrefs have a target.
104104
const ids = new Set();
105105
const idRe = / id="([^"]+)"/g;
106-
let match;
107-
while (match = idRe.exec(all)) {
106+
const idMatches = all.matchAll(idRe);
107+
for (const match of idMatches) {
108108
ids.add(match[1]);
109109
}
110110

111111
const hrefRe = / href="#([^"]+)"/g;
112-
while (match = hrefRe.exec(all)) {
112+
const hrefMatches = all.matchAll(hrefRe);
113+
for (const match of hrefMatches) {
113114
if (!ids.has(match[1])) throw new Error(`link not found: ${match[1]}`);
114115
}

0 commit comments

Comments
 (0)