1.0.1 • Published 6 years ago

comment-tag-extractor v1.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

comment-tag-extractor

Install

Install with npm:

$ npm install --save comment-tag-extractor

Install with yarn:

$ yarn add comment-tag-extractor

Usage

import {extract, parse} from 'comment-tag-extractor';

const code = `
  /**
    * @name Button
    * @description Button component.
    *
    * @class .btn
    * @class .btn--primary
    *
    * @example
    * <div class="{{modifier}}">Button</div>
    *
    * @section 1.3.2
    */
`;

const tags = parse(extract(code));
console.log(tags);

// Will output:
// {
//   name: [ 'Button' ],
//   description: [ 'Button component.' ],
//   class: [ '.btn', '.btn--primary' ],
//   example: [ '<div class="{{modifier}}">Button</div>' ],
//   section: [ '1.3.2' ]
// }

Mentions

Adapted from jest-codeblocks.