Provides a more flexible mechanism to modify JSDoc comment blocks. comment-parser is the main parsing mechanism that esm-d-ts uses as well as the supporting package @es-joy/jsdoccomment for ESTree AST compatible parsing. The latter AST format is much easier to modify and recreate a comment block.

Index

Constructors

Accessors

Methods

Constructors

  • Parameters

    • rawComment: string

      A JSDoc comment string.

    • Optionaloptions: { mode?: "closure" | "jsdoc" | "typescript"; spacing?: "compact" | "preserve" }

      Options.

      • Optionalmode?: "closure" | "jsdoc" | "typescript"

        Type parsing mode; by default, typescript is enabled.

      • Optionalspacing?: "compact" | "preserve"

        Parsed comment spacing; by default, spacing is preserved.

    Returns ESTreeParsedComment

Accessors

  • get ast(): JsdocBlock

    Returns JsdocBlock

    ESTree AST.

Methods

  • 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.

  • 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.

  • Returns string

    Returns the comment block with current AST converted back to a string.