Skip to content

Commit d2ee6f5

Browse files
committed
Merge branch 'descriptions' of https://github.com/Bashamega/TypeScript-DOM-lib-generator into descriptions
2 parents 94d22b9 + 11d8d3e commit d2ee6f5

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/build/mdn-comments.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ const types: Record<string, string> = {
7373
};
7474

7575
function generateTypes(content: string): string[] | undefined {
76-
const pageType = content.match(/page-type:\s*["']?([^"'\n]+)["']?/);
77-
if (!pageType) throw new Error("pageType not found");
78-
76+
const pageType = content.match(/page-type:\s*["']?([^"'\n]+)["']?/)!;
7977
const type = pageType[1].split("-").pop()!;
8078
const plural = types[type];
8179
if (!plural) return;
@@ -84,9 +82,7 @@ function generateTypes(content: string): string[] | undefined {
8482
}
8583

8684
function generateSlug(content: string): string[] {
87-
const match = content.match(/slug:\s*["']?([^"'\n]+)["']?/);
88-
if (!match) throw new Error("Slug not found");
89-
85+
const match = content.match(/slug:\s*["']?([^"'\n]+)["']?/)!;
9086
const url = match[1].split(":").pop()!;
9187
const parts = url.split("/").slice(2); // skip `/en-US/web/api/...`
9288
return parts; // Keep only top-level and method

0 commit comments

Comments
 (0)