Home Manual Reference Source Test Repository
import CommentParser from 'esdoc/src/Parser/CommentParser.js'
public class | source

CommentParser

Doc Comment Parser class.

Example:

for (let comment of node.leadingComments) {
  let tags = CommentParser.parse(comment);
  console.log(tags);
}

Test:

Static Method Summary

Static Public Methods
public static

isESDoc(commentNode: ASTNode): boolean

judge doc comment or not.

public static

parse(commentNode: ASTNode): Tag[]

parse comment to tags.

Static Public Methods

public static isESDoc(commentNode: ASTNode): boolean source

judge doc comment or not.

Params:

NameTypeAttributeDescription
commentNode ASTNode

comment node.

Return:

boolean

if true, this comment node is doc comment.

Test:

public static parse(commentNode: ASTNode): Tag[] source

parse comment to tags.

Params:

NameTypeAttributeDescription
commentNode ASTNode

comment node.

commentNode.value string

comment body.

commentNode.type string

Block or Line.

Return:

Tag[]

parsed comment.

Test: