• Provides a convenient "meta-transformer" that invokes a handler function for each Node reducing the boilerplate required w/ the parsed leading comment data for the Node. Only leading block comments are parsed. The parsed array is in the data format provided by the comment-parser package. For convenience there are lastComment and lastParsed fields that return the last comment block respectively before the node. Typically, the last comment is the active JSDoc block for a Node.

    Note: In the handler return null to remove the Node. The postHandler allows final modification of the SourceFile after all nodes are visited; return a new SourceFile to update it.

    Parameters

    • handler: ((data) => any)

      A function to process AST nodes with JSDoc comments.

        • (data): any
        • Parameters

          • data: {
                comments: string[];
                lastComment: string;
                lastParsed: Block;
                node: Node;
                parsed: Block[];
                sourceFile: SourceFile;
            }
            • comments: string[]
            • lastComment: string
            • lastParsed: Block
            • node: Node
            • parsed: Block[]
            • sourceFile: SourceFile

          Returns any

    • Optional postHandler: ((sourceFile) => SourceFile)

      A function to postprocess the source file after all nodes visited. Return an updated SourceFile node.

        • (sourceFile): SourceFile
        • Parameters

          • sourceFile: SourceFile

          Returns SourceFile

    Returns ts.TransformerFactory<ts.Bundle | ts.SourceFile>

    JSDoc custom "meta-transformer".