Class ESTreeParsedComment
Index
Constructors
constructor
- new ESTreeParsedComment(
rawComment: string,
options?: {
mode?: "closure" | "jsdoc" | "typescript";
spacing?: "compact" | "preserve";
},
): ESTreeParsedCommentParameters
- rawComment: string
A JSDoc comment string.
Optionaloptions: { mode?: "closure" | "jsdoc" | "typescript"; spacing?: "compact" | "preserve" }Options.
Optionalmode?: "closure" | "jsdoc" | "typescript"Type parsing mode; by default,
typescriptis enabled.Optionalspacing?: "compact" | "preserve"Parsed comment spacing; by default, spacing is
preserved.
Returns ESTreeParsedComment
- rawComment: string
Methods
removeTags
Removes the JSDoc tags specified from the AST.
Parameters
OptionaltagNames: string | Iterable<string, any, any>A string or Set of strings defining tag names to remove from the AST. When undefined all tags are removed.
Returns this
This instance.
tags
Provides an iterator over all tags or a subset from the given tag names.
Parameters
OptionaltagNames: string | Iterable<string, any, any>A string or Set of strings defining tag names to iterate.
Returns IterableIterator<JsdocTag>
Tag iterator.
toString
Returns string
Returns the comment block with current AST converted back to a string.
Provides a more flexible mechanism to modify JSDoc comment blocks.
comment-parseris the main parsing mechanism thatesm-d-tsuses as well as the supporting package@es-joy/jsdoccommentfor ESTree AST compatible parsing. The latter AST format is much easier to modify and recreate a comment block.