From 45296caabf4e9414f43ca359594624684626a0d1 Mon Sep 17 00:00:00 2001 From: Igor <86978055+Poliklot@users.noreply.github.com> Date: Fri, 3 Jan 2025 22:12:03 +0300 Subject: [PATCH] Fixed duplication of "Default is ..." in documentation comments. (#236) 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. --- src/parser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser.ts b/src/parser.ts index e6a82ce..05fd1fd 100755 --- a/src/parser.ts +++ b/src/parser.ts @@ -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)) {