Skip to content

Commit 968a4e4

Browse files
committed
simplify
1 parent fdddfa6 commit 968a4e4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/build/mdn-comments.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ function extractSummary(markdown: string): string {
4242

4343
// Extract the first sentence (ending in . ! or ?)
4444
const sentenceMatch = normalizedText.match(/(.*?[.!?])(?=\s|$)/);
45-
return sentenceMatch ? sentenceMatch[0] : normalizedText.split(" ")[0] || "";
45+
if (sentenceMatch) {
46+
return sentenceMatch[0];
47+
}
48+
49+
const firstWord = normalizedText.split(" ")[0];
50+
return firstWord || "";
4651
}
4752

4853
async function walkDirectory(dir: URL): Promise<URL[]> {

0 commit comments

Comments
 (0)