@code-to-json/comments
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-rc.47 • Public • Published

@code-to-json/comments

Parse JSDoc or TSDoc style comments into structured data

Build Status Build Status Version codecov Total alerts


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

Readme

Keywords

none

Package Sidebar

Install

npm i @code-to-json/comments

Weekly Downloads

76

Version

1.0.0-rc.47

License

BSD-2-Clause

Unpacked Size

209 kB

Total Files

88

Last publish

Collaborators

  • mike-north-bot
  • northm