diff options
| author | Matt Mayer <[email protected]> | 2022-09-08 23:40:52 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-09-08 16:40:52 +0000 |
| commit | 1fe2877d0c6b237b3d1a5b6b29c4749578a8f9a4 (patch) | |
| tree | 85cc657b23f9209dcba347823f0e47ac70b7d8a6 /scripts | |
| parent | 508082cbde088d2834b324c15dd75f326cb896c7 (diff) | |
| download | faker-1fe2877d0c6b237b3d1a5b6b29c4749578a8f9a4.tar.xz faker-1fe2877d0c6b237b3d1a5b6b29c4749578a8f9a4.zip | |
docs: add `@since` tags to all methods (#1337)
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/apidoc/signature.ts | 2 | ||||
| -rw-r--r-- | scripts/apidoc/utils.ts | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index 62b65ee8..7a8309ee 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -21,6 +21,7 @@ import { faker } from '../../src'; import { extractRawExamples, extractSeeAlsos, + extractSince, formatTypescript, isDeprecated, joinTagParts, @@ -153,6 +154,7 @@ export function analyzeSignature( title: prettyMethodName, description: mdToHtml(toBlock(signature.comment)), parameters: parameters, + since: extractSince(signature), returns: typeToText(signature.type), examples: mdToHtml(`${code}ts\n${examples}${code}`), deprecated: isDeprecated(signature), diff --git a/scripts/apidoc/utils.ts b/scripts/apidoc/utils.ts index 783bf974..651a0119 100644 --- a/scripts/apidoc/utils.ts +++ b/scripts/apidoc/utils.ts @@ -146,3 +146,14 @@ export function joinTagParts(parts?: CommentDisplayPart[]): string | undefined { export function isDeprecated(signature: SignatureReflection): boolean { return extractTagContent('@deprecated', signature).length > 0; } + +/** + * Extracts the "since" tag from the provided signature. + * + * @param signature The signature to check. + * + * @returns the contents of the @since tag + */ +export function extractSince(signature: SignatureReflection): string { + return extractTagContent('@since', signature).join().trim(); +} |
