@code-to-json/comments
v1.0.0-rc.47
Published
Comment-parsing utilities for code-to-json
Downloads
42
Readme
@code-to-json/comments
Parse JSDoc or TSDoc style comments into structured data
Usage
First, install this package as a dependency
yarn add @code-to-json/comments
Then, import the parseCommentString
function, and pass it stringified code comment
import { parseCommentString } from '@code-to-json/comments';
parseCommentString(`
/**
* This is only a comment in a file
*
* @example
*
* function foo() {}
* foo(); // equal: undefined
*
*/
`);
which should return a CommentData
value like this
{
"summary": ["This is only a comment in a file"],
"customTags": [
{
"content": ["function foo() {} ", "\n", "foo(); // equal: undefined"],
"kind": "blockTag",
"tagName": "example"
}
]
}
© 2018 LinkedIn