aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2022-04-20 08:22:09 +0200
committerGitHub <[email protected]>2022-04-20 06:22:09 +0000
commitb99bbb5ee6d4b8c311afb00eaaa67c193ca0c4ef (patch)
tree7e7fa060fbf0d4971e92cea4c28299a9936d28e4 /scripts
parent00b9d4be4bff3b3f64edf163768af71c99bceed1 (diff)
downloadfaker-b99bbb5ee6d4b8c311afb00eaaa67c193ca0c4ef.tar.xz
faker-b99bbb5ee6d4b8c311afb00eaaa67c193ca0c4ef.zip
docs: fix lost description texts (#836)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/apidoc/signature.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts
index 704c4dad..154d1c72 100644
--- a/scripts/apidoc/signature.ts
+++ b/scripts/apidoc/signature.ts
@@ -301,14 +301,17 @@ function extractDefaultFromComment(comment?: Comment): string {
if (!comment) {
return;
}
- const text = comment.shortText;
- if (!text || text.trim() === '') {
+ const text = comment.shortText?.trim();
+ if (!text) {
return;
}
- const result = /(.*)[ \n]Defaults to `([^`]+)`./.exec(text);
+ const result = /^(.*)[ \n]Defaults to `([^`]+)`\.(.*)$/s.exec(text);
if (!result) {
return;
}
+ if (result[3].trim()) {
+ throw new Error(`Found description text after the default value:\n${text}`);
+ }
comment.shortText = result[1];
return result[2];
}