Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4a57d47

Browse filesBrowse files
Trotttargos
authored andcommitted
tools: replace while+exec() with matchAll()
PR-URL: #41406 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 4a369d0 commit 4a57d47
Copy full SHA for 4a57d47

File tree

Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed
Open diff view settings
Collapse file

‎tools/doc/allhtml.mjs‎

Copy file name to clipboardExpand all lines: tools/doc/allhtml.mjs
+4-3Lines changed: 4 additions & 3 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.