Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e349c33
commit 5f6bb7f
Showing
6 changed files
with
170 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import ts from "typescript"; | ||
import { SimplifiedJSDocTag } from "../config"; | ||
|
||
/** | ||
* Get a simplified version of a node JSDocTags. | ||
* | ||
* @param jsDocs | ||
*/ | ||
export function getSimplifiedJsDocTags( | ||
jsDocs: ts.JSDoc[] | ||
): SimplifiedJSDocTag[] { | ||
const tags: SimplifiedJSDocTag[] = []; | ||
jsDocs.forEach((jsDoc) => { | ||
(jsDoc.tags || []).forEach((tag) => { | ||
const name = tag.tagName.escapedText.toString(); | ||
const value = typeof tag.comment === "string" ? tag.comment : undefined; | ||
tags.push({ name, value }); | ||
}); | ||
}); | ||
|
||
return tags; | ||
} |