Skip to content

Commit

Permalink
Fixed duplication of "Default is ..." in documentation comments. (#236)
Browse files Browse the repository at this point in the history
The function `addDefaultValueToDescription` was appending multiple "Default is ..." notes to the description upon repeated invocations. This issue has been resolved by updating the regular expression to remove all existing occurrences of "Default is ..." before appending the new default value note.
  • Loading branch information
Poliklot authored Jan 3, 2025
1 parent 7a884b6 commit 45296ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ function addDefaultValueToDescription(tag: Spec): Spec {
let { description } = tag;

// remove old note
description = description.replace(/[\s]*Default[\s]*is[\s]*`.*`\.?$/, "");
description = description.replace(/(?:\s*Default\s+is\s+`.*?`\.?)+/g, "");

// add a `.` at the end of previous sentences
if (description && !/[.\n]$/.test(description)) {
Expand Down

0 comments on commit 45296ca

Please sign in to comment.